Bug 845545: Part 1 - Fix heap dumping to work off the main thread. r=mccr8

This commit is contained in:
Kyle Huey 2013-08-03 16:55:39 -07:00
Родитель 1e0d44226f
Коммит 92d60a1477
5 изменённых файлов: 12 добавлений и 11 удалений

Просмотреть файл

@ -1445,14 +1445,6 @@ Base64Decode(JSContext *cx, JS::Value val, JS::Value *out)
return true;
}
void
DumpJSHeap(FILE* file)
{
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Must dump GC heap on main thread.");
nsXPConnect* xpc = nsXPConnect::XPConnect();
js::DumpHeapComplete(xpc->GetRuntime()->Runtime(), file);
}
void
SetLocationForGlobal(JSObject *global, const nsACString& location)
{

Просмотреть файл

@ -321,8 +321,6 @@ nsIPrincipal *GetObjectPrincipal(JSObject *obj);
bool IsXBLScope(JSCompartment *compartment);
void DumpJSHeap(FILE* file);
void SetLocationForGlobal(JSObject *global, const nsACString& location);
void SetLocationForGlobal(JSObject *global, nsIURI *locationURI);

Просмотреть файл

@ -1032,6 +1032,13 @@ CycleCollectedJSRuntime::DeferredFinalize(nsISupports* aSupports)
mDeferredSupports.AppendElement(aSupports);
}
void
CycleCollectedJSRuntime::DumpJSHeap(FILE* file)
{
js::DumpHeapComplete(Runtime(), file);
}
bool
ReleaseSliceNow(uint32_t aSlice, void* aData)
{

Просмотреть файл

@ -196,6 +196,8 @@ public:
void* aThing);
void DeferredFinalize(nsISupports* aSupports);
void DumpJSHeap(FILE* aFile);
private:
JSGCThingParticipant mGCThingCycleCollectorGlobal;

Просмотреть файл

@ -1447,7 +1447,9 @@ public:
gcLogFile->OpenANSIFileDesc("w", &gcLogANSIFile);
NS_ENSURE_STATE(gcLogANSIFile);
MozillaRegisterDebugFILE(gcLogANSIFile);
xpc::DumpJSHeap(gcLogANSIFile);
CollectorData *data = sCollectorData.get();
if (data && data->mRuntime)
data->mRuntime->DumpJSHeap(gcLogANSIFile);
MozillaUnRegisterDebugFILE(gcLogANSIFile);
fclose(gcLogANSIFile);