Bug 1265243 - Do not initialize CacheObserver in the child process, r=honzab
authorMichal Novotny <michal.novotny@gmail.com>
Wed, 20 Apr 2016 11:29:50 +0200
changeset 331887 5743f4601d3f75ee3d77a5a0b4138821b1df7d8b
parent 331886 da9b8b7a0263ce4ac6ca83b6fe225dc5ebf39692
child 331888 182a164b91ecba718b49f260f241f6cf2d22cfd3
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershonzab
bugs1265243
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1265243 - Do not initialize CacheObserver in the child process, r=honzab
netwerk/cache2/CacheObserver.cpp
--- a/netwerk/cache2/CacheObserver.cpp
+++ b/netwerk/cache2/CacheObserver.cpp
@@ -8,16 +8,17 @@
 #include "CacheFileIOManager.h"
 #include "LoadContextInfo.h"
 #include "nsICacheStorage.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TimeStamp.h"
 #include "nsServiceManagerUtils.h"
+#include "mozilla/net/NeckoCommon.h"
 #include "prsystem.h"
 #include <time.h>
 #include <math.h>
 
 namespace mozilla {
 namespace net {
 
 CacheObserver* CacheObserver::sSelf = nullptr;
@@ -99,16 +100,20 @@ int32_t CacheObserver::sMaxShutdownIOLag
 NS_IMPL_ISUPPORTS(CacheObserver,
                   nsIObserver,
                   nsISupportsWeakReference)
 
 // static
 nsresult
 CacheObserver::Init()
 {
+  if (IsNeckoChild()) {
+    return NS_OK;
+  }
+
   if (sSelf) {
     return NS_OK;
   }
 
   nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
   if (!obs) {
     return NS_ERROR_UNEXPECTED;
   }