mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
Bug 929297 - Part 2: Avoid calling amIAddonManager in reporters off the main process. r=njn
This commit is contained in:
parent
a6699d7288
commit
ccc8856587
@ -484,8 +484,11 @@ nsWindowMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
|
||||
|
||||
// Collect window memory usage.
|
||||
nsWindowSizes windowTotalSizes(NULL);
|
||||
nsCOMPtr<amIAddonManager> addonManager =
|
||||
do_GetService("@mozilla.org/addons/integration;1");
|
||||
nsCOMPtr<amIAddonManager> addonManager;
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
// Only try to access the service from the main process.
|
||||
addonManager = do_GetService("@mozilla.org/addons/integration;1");
|
||||
}
|
||||
for (uint32_t i = 0; i < windows.Length(); i++) {
|
||||
rv = CollectWindowReports(windows[i], addonManager,
|
||||
&windowTotalSizes, &ghostWindows,
|
||||
|
@ -1990,6 +1990,11 @@ private:
|
||||
|
||||
mAlreadyMappedToAddon = true;
|
||||
|
||||
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
||||
// Only try to access the service from the main process.
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString addonId;
|
||||
bool ok;
|
||||
nsCOMPtr<amIAddonManager> addonManager =
|
||||
|
@ -2366,8 +2366,11 @@ ReportJSRuntimeExplicitTreeStats(const JS::RuntimeStats &rtStats,
|
||||
nsIMemoryReporterCallback *cb,
|
||||
nsISupports *closure, size_t *rtTotalOut)
|
||||
{
|
||||
nsCOMPtr<amIAddonManager> am =
|
||||
do_GetService("@mozilla.org/addons/integration;1");
|
||||
nsCOMPtr<amIAddonManager> am;
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
// Only try to access the service from the main process.
|
||||
am = do_GetService("@mozilla.org/addons/integration;1");
|
||||
}
|
||||
return ReportJSRuntimeExplicitTreeStats(rtStats, rtPath, am.get(), cb,
|
||||
closure, rtTotalOut);
|
||||
}
|
||||
@ -2604,8 +2607,11 @@ JSReporter::CollectReports(WindowPaths *windowPaths,
|
||||
// callback may be a JS function, and executing JS while getting these
|
||||
// stats seems like a bad idea.
|
||||
|
||||
nsCOMPtr<amIAddonManager> addonManager =
|
||||
do_GetService("@mozilla.org/addons/integration;1");
|
||||
nsCOMPtr<amIAddonManager> addonManager;
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
// Only try to access the service from the main process.
|
||||
addonManager = do_GetService("@mozilla.org/addons/integration;1");
|
||||
}
|
||||
bool getLocations = !!addonManager;
|
||||
XPCJSRuntimeStats rtStats(windowPaths, topWindowPaths, getLocations);
|
||||
OrphanReporter orphanReporter(XPCConvert::GetISupportsFromJSObject);
|
||||
|
Loading…
x
Reference in New Issue
Block a user