Bug 948774 - Don't broadcast a memory report request to the Nuwa process. r=fabrice, a=1.3+
authorKyle Huey <khuey@kylehuey.com>
Tue, 14 Jan 2014 10:35:08 -0800
changeset 175732 82580c76dc22b62871a095c9db0ab5b998685f1b
parent 175731 bb7bae085b9d93bb2d00d90f10175a6dc28afba1
child 175733 ae2c436cecdcfc264a70eb63cb39c9e1c71bac85
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice, 1
bugs948774
milestone28.0a2
Bug 948774 - Don't broadcast a memory report request to the Nuwa process. r=fabrice, a=1.3+
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1224,23 +1224,27 @@ ContentParent::InitializeMembers()
 ContentParent::ContentParent(mozIApplication* aApp,
                              bool aIsForBrowser,
                              bool aIsForPreallocated,
                              ChildPrivileges aOSPrivileges,
                              ProcessPriority aInitialPriority /* = PROCESS_PRIORITY_FOREGROUND */,
                              bool aIsNuwaProcess /* = false */)
     : mOSPrivileges(aOSPrivileges)
     , mIsForBrowser(aIsForBrowser)
+    , mIsNuwaProcess(aIsNuwaProcess)
 {
     InitializeMembers();  // Perform common initialization.
 
-    // No more than one of !!aApp, aIsForBrowser, and aIsForPreallocated should
-    // be true.
+    // No more than one of !!aApp, aIsForBrowser, aIsForPreallocated should be
+    // true.
     MOZ_ASSERT(!!aApp + aIsForBrowser + aIsForPreallocated <= 1);
 
+    // Only the preallocated process uses Nuwa.
+    MOZ_ASSERT_IF(aIsNuwaProcess, aIsForPreallocated);
+
     // Insert ourselves into the global linked list of ContentParent objects.
     if (!sContentParents) {
         sContentParents = new LinkedList<ContentParent>();
     }
     if (!aIsNuwaProcess) {
         sContentParents->insertBack(this);
     }
 
@@ -1303,16 +1307,17 @@ FindFdProtocolFdMapping(const nsTArray<P
 ContentParent::ContentParent(ContentParent* aTemplate,
                              const nsAString& aAppManifestURL,
                              base::ProcessHandle aPid,
                              const nsTArray<ProtocolFdMapping>& aFds,
                              ChildPrivileges aOSPrivileges)
     : mOSPrivileges(aOSPrivileges)
     , mAppManifestURL(aAppManifestURL)
     , mIsForBrowser(false)
+    , mIsNuwaProcess(false)
 {
     InitializeMembers();  // Perform common initialization.
 
     sContentParents->insertBack(this);
 
     // From this point on, NS_WARNING, NS_ASSERTION, etc. should print out the
     // PID along with the warning.
     nsDebugImpl::SetMultiprocessMode("Parent");
@@ -1483,16 +1488,24 @@ ContentParent::IsAlive()
 }
 
 bool
 ContentParent::IsForApp()
 {
     return !mAppManifestURL.IsEmpty();
 }
 
+#ifdef MOZ_NUWA_PROCESS
+bool
+ContentParent::IsNuwaProcess()
+{
+    return mIsNuwaProcess;
+}
+#endif
+
 int32_t
 ContentParent::Pid()
 {
     if (!mSubprocess || !mSubprocess->GetChildProcessHandle()) {
         return -1;
     }
     return base::GetProcId(mSubprocess->GetChildProcessHandle());
 }
@@ -1868,17 +1881,20 @@ ContentParent::Observe(nsISupports* aSub
     else if (!strcmp(aTopic, "alertfinished") ||
              !strcmp(aTopic, "alertclickcallback") ||
              !strcmp(aTopic, "alertshow") ) {
         if (!SendNotifyAlertsObserver(nsDependentCString(aTopic),
                                       nsDependentString(aData)))
             return NS_ERROR_NOT_AVAILABLE;
     }
     else if (!strcmp(aTopic, "child-memory-reporter-request")) {
-        unused << SendPMemoryReportRequestConstructor((uint32_t)(uintptr_t)aData);
+#ifdef MOZ_NUWA_PROCESS
+        if (!IsNuwaProcess())
+#endif
+            unused << SendPMemoryReportRequestConstructor((uint32_t)(uintptr_t)aData);
     }
     else if (!strcmp(aTopic, "child-gc-request")){
         unused << SendGarbageCollect();
     }
     else if (!strcmp(aTopic, "child-cc-request")){
         unused << SendCycleCollect();
     }
     else if (!strcmp(aTopic, "child-mmu-request")){
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -138,16 +138,19 @@ public:
     TestShellParent* GetTestShellSingleton();
     jsipc::JavaScriptParent *GetCPOWManager();
 
     void ReportChildAlreadyBlocked();
     bool RequestRunToCompletion();
 
     bool IsAlive();
     bool IsForApp();
+#ifdef MOZ_NUWA_PROCESS
+    bool IsNuwaProcess();
+#endif
 
     GeckoChildProcessHost* Process() {
         return mSubprocess;
     }
 
     int32_t Pid();
 
     bool NeedsPermissionsUpdate() {
@@ -546,16 +549,17 @@ private:
     // True only while this is ready to be used to host remote tabs.
     // This must not be used for new purposes after mIsAlive goes to
     // false, but some previously scheduled IPC traffic may still pass
     // through.
     bool mIsAlive;
 
     bool mSendPermissionUpdates;
     bool mIsForBrowser;
+    bool mIsNuwaProcess;
 
     // These variables track whether we've called Close(), CloseWithError()
     // and KillHard() on our channel.
     bool mCalledClose;
     bool mCalledCloseWithError;
     bool mCalledKillHard;
 
     friend class CrashReporterParent;