Bug 806965 - Initialize new child processes with the current offline state. r=jlebar a=blocking-basecamp+
authorBlake Kaplan <mrbkap@gmail.com>
Thu, 08 Nov 2012 13:09:39 -0800
changeset 116788 b05679d0dc77b0a207902aa2c7e48c09ebc7f63b
parent 116787 7be95f3c39b22d27ee72860854dfd953e963978a
child 116789 1e01edd1a7a1daacd8a924531c6e3ac53a9e23fc
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlebar, blocking-basecamp
bugs806965
milestone18.0a2
Bug 806965 - Initialize new child processes with the current offline state. r=jlebar a=blocking-basecamp+
dom/ipc/ContentChild.cpp
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/PContent.ipdl
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -330,16 +330,20 @@ ContentChild::InitXPCOM()
     if (!svc) {
         NS_WARNING("Couldn't acquire console service");
         return;
     }
 
     mConsoleListener = new ConsoleListener(this);
     if (NS_FAILED(svc->RegisterListener(mConsoleListener)))
         NS_WARNING("Couldn't register console listener for child process");
+
+    bool isOffline;
+    SendGetXPCOMProcessAttributes(&isOffline);
+    RecvSetOffline(isOffline);
 }
 
 PMemoryReportRequestChild*
 ContentChild::AllocPMemoryReportRequest()
 {
     return new MemoryReportRequestChild();
 }
 
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1140,16 +1140,28 @@ bool
 ContentParent::RecvGetProcessAttributes(uint64_t* aId, bool* aStartBackground,
                                         bool* aIsForApp, bool* aIsForBrowser)
 {
     *aId = gContentChildID++;
     *aStartBackground =
         (mAppManifestURL == MAGIC_PREALLOCATED_APP_MANIFEST_URL);
     *aIsForApp = IsForApp();
     *aIsForBrowser = mIsForBrowser;
+
+    return true;
+}
+
+bool
+ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline)
+{
+    nsCOMPtr<nsIIOService> io(do_GetIOService());
+    NS_ASSERTION(io, "No IO service?");
+    DebugOnly<nsresult> rv = io->GetOffline(aIsOffline);
+    NS_ASSERTION(NS_SUCCEEDED(rv), "Failed getting offline?");
+
     return true;
 }
 
 PBrowserParent*
 ContentParent::AllocPBrowser(const uint32_t& aChromeFlags,
                              const bool& aIsBrowserElement, const AppId& aApp)
 {
     // We only use this Alloc() method when the content processes asks
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -181,16 +181,17 @@ private:
     PImageBridgeParent*
     AllocPImageBridge(mozilla::ipc::Transport* aTransport,
                       base::ProcessId aOtherProcess) MOZ_OVERRIDE;
 
     virtual bool RecvGetProcessAttributes(uint64_t* aId,
                                           bool* aStartBackground,
                                           bool* aIsForApp,
                                           bool* aIsForBrowser) MOZ_OVERRIDE;
+    virtual bool RecvGetXPCOMProcessAttributes(bool* aIsOffline) MOZ_OVERRIDE;
 
     virtual PBrowserParent* AllocPBrowser(const uint32_t& aChromeFlags,
                                           const bool& aIsBrowserElement,
                                           const AppId& aApp);
     virtual bool DeallocPBrowser(PBrowserParent* frame);
 
     virtual PDeviceStorageRequestParent* AllocPDeviceStorageRequest(const DeviceStorageParams&);
     virtual bool DeallocPDeviceStorageRequest(PDeviceStorageRequestParent*);
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -266,16 +266,18 @@ parent:
      * |id| is a unique ID among all subprocesses.  When |isForApp &&
      * isForBrowser|, we're loading <browser> for an app.  When
      * |isForBrowser|, we're loading <browser>.  When |!isForApp &&
      * !isForBrowser|, we're probably loading <xul:browser remote>.
      */
     sync GetProcessAttributes()
         returns (uint64_t id, bool startBackground,
                  bool isForApp, bool isForBrowser);
+    sync GetXPCOMProcessAttributes()
+        returns (bool isOffline);
 
     PAudio(int32_t aNumChannels, int32_t aRate, int32_t aFormat);
 
     PDeviceStorageRequest(DeviceStorageParams params);
 
     sync PCrashReporter(NativeThreadId tid, uint32_t processType);
 
     PHal();