mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 752381 - Merge System Principal compartments in about:memory. r=jlebar.
This commit is contained in:
parent
d573b50a05
commit
f1e81b0077
@ -1197,7 +1197,7 @@ XPCJSRuntime::~XPCJSRuntime()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
GetCompartmentName(JSCompartment *c, bool getAddress, nsCString &name)
|
GetCompartmentName(JSCompartment *c, nsCString &name)
|
||||||
{
|
{
|
||||||
if (js::IsAtomsCompartment(c)) {
|
if (js::IsAtomsCompartment(c)) {
|
||||||
name.AssignLiteral("atoms");
|
name.AssignLiteral("atoms");
|
||||||
@ -1205,9 +1205,6 @@ GetCompartmentName(JSCompartment *c, bool getAddress, nsCString &name)
|
|||||||
nsJSPrincipals::get(principals)->GetScriptLocation(name);
|
nsJSPrincipals::get(principals)->GetScriptLocation(name);
|
||||||
|
|
||||||
// For system compartments we append the location, if there is one.
|
// For system compartments we append the location, if there is one.
|
||||||
// And we append the address if |getAddress| is true, so that
|
|
||||||
// multiple system compartments (and there can be many) can be
|
|
||||||
// distinguished.
|
|
||||||
if (js::IsSystemCompartment(c)) {
|
if (js::IsSystemCompartment(c)) {
|
||||||
xpc::CompartmentPrivate *compartmentPrivate =
|
xpc::CompartmentPrivate *compartmentPrivate =
|
||||||
static_cast<xpc::CompartmentPrivate*>(JS_GetCompartmentPrivate(c));
|
static_cast<xpc::CompartmentPrivate*>(JS_GetCompartmentPrivate(c));
|
||||||
@ -1215,12 +1212,6 @@ GetCompartmentName(JSCompartment *c, bool getAddress, nsCString &name)
|
|||||||
name.AppendLiteral(", ");
|
name.AppendLiteral(", ");
|
||||||
name.Append(compartmentPrivate->location);
|
name.Append(compartmentPrivate->location);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getAddress) {
|
|
||||||
// ample; 64-bit address max is 18 chars
|
|
||||||
nsPrintfCString address(", 0x%llx", PRUint64(c));
|
|
||||||
name.Append(address);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// A hack: replace forward slashes with '\\' so they aren't
|
// A hack: replace forward slashes with '\\' so they aren't
|
||||||
@ -1641,7 +1632,7 @@ class JSCompartmentsMultiReporter : public nsIMemoryMultiReporter
|
|||||||
// silently ignore OOM errors
|
// silently ignore OOM errors
|
||||||
Paths *paths = static_cast<Paths *>(data);
|
Paths *paths = static_cast<Paths *>(data);
|
||||||
nsCString path;
|
nsCString path;
|
||||||
GetCompartmentName(c, /* getAddress = */ false, path);
|
GetCompartmentName(c, path);
|
||||||
path.Insert(js::IsSystemCompartment(c)
|
path.Insert(js::IsSystemCompartment(c)
|
||||||
? NS_LITERAL_CSTRING("compartments/system/")
|
? NS_LITERAL_CSTRING("compartments/system/")
|
||||||
: NS_LITERAL_CSTRING("compartments/user/"),
|
: NS_LITERAL_CSTRING("compartments/user/"),
|
||||||
@ -1698,7 +1689,7 @@ struct XPCJSRuntimeStats : public JS::RuntimeStats {
|
|||||||
virtual void initExtraCompartmentStats(JSCompartment *c,
|
virtual void initExtraCompartmentStats(JSCompartment *c,
|
||||||
JS::CompartmentStats *cstats) MOZ_OVERRIDE {
|
JS::CompartmentStats *cstats) MOZ_OVERRIDE {
|
||||||
nsCAutoString name;
|
nsCAutoString name;
|
||||||
GetCompartmentName(c, /* getAddress = */ true, name);
|
GetCompartmentName(c, name);
|
||||||
cstats->extra = strdup(name.get());
|
cstats->extra = strdup(name.get());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user