Backed out changeset 82eb59127df7 (bug 1274516) for build bustage a=backout
authorWes Kocher <wkocher@mozilla.com>
Wed, 29 Jun 2016 10:41:25 -0700
changeset 335485 b743fe6eabb8328430d91275462dc8e2a42eef81
parent 335484 b292e3d9cb2f50e55956b3d3b8d6290ae38268e6
child 335486 311fec989776d55026e1ce3c8900350e1483209e
push id1146
push userCallek@gmail.com
push dateMon, 25 Jul 2016 16:35:44 +0000
treeherdermozilla-release@a55778f9cd5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1274516
milestone48.0
backs out82eb59127df7b326ecec29c9cb462b4671320302
Backed out changeset 82eb59127df7 (bug 1274516) for build bustage a=backout
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/PContent.ipdl
image/imgLoader.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -53,17 +53,16 @@
 #include "mozilla/net/NeckoChild.h"
 #include "mozilla/plugins/PluginInstanceParent.h"
 #include "mozilla/plugins/PluginModuleParent.h"
 #include "mozilla/widget/WidgetMessageUtils.h"
 #include "nsBaseDragService.h"
 #include "mozilla/media/MediaChild.h"
 #include "mozilla/BasePrincipal.h"
 #include "mozilla/WebBrowserPersistDocumentChild.h"
-#include "imgLoader.h"
 
 #if defined(MOZ_CONTENT_SANDBOX)
 #if defined(XP_WIN)
 #define TARGET_SANDBOX_EXPORTS
 #include "mozilla/sandboxTarget.h"
 #elif defined(XP_LINUX)
 #include "mozilla/Sandbox.h"
 #include "mozilla/SandboxInfo.h"
@@ -2205,26 +2204,16 @@ ContentChild::RecvRegisterChromeItem(con
       MOZ_ASSERT(false, "bad chrome item");
       return false;
   }
 
   return true;
 }
 
 bool
-ContentChild::RecvClearImageCache(const bool& privateLoader, const bool& chrome)
-{
-  imgLoader* loader = privateLoader ? imgLoader::PrivateBrowsingLoader() :
-                                      imgLoader::NormalLoader();
-
-  loader->ClearCache(chrome);
-  return true;
-}
-
-bool
 ContentChild::RecvSetOffline(const bool& offline)
 {
   nsCOMPtr<nsIIOService> io (do_GetIOService());
   NS_ASSERTION(io, "IO Service can not be null");
 
   io->SetOffline(offline);
 
   return true;
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -377,19 +377,16 @@ public:
 
   virtual bool RecvRegisterChrome(InfallibleTArray<ChromePackage>&& packages,
                                   InfallibleTArray<SubstitutionMapping>&& resources,
                                   InfallibleTArray<OverrideMapping>&& overrides,
                                   const nsCString& locale,
                                   const bool& reset) override;
   virtual bool RecvRegisterChromeItem(const ChromeRegistryItem& item) override;
 
-  virtual bool RecvClearImageCache(const bool& privateLoader,
-                                   const bool& chrome) override;
-
   virtual mozilla::jsipc::PJavaScriptChild* AllocPJavaScriptChild() override;
 
   virtual bool DeallocPJavaScriptChild(mozilla::jsipc::PJavaScriptChild*) override;
 
   virtual PRemoteSpellcheckEngineChild* AllocPRemoteSpellcheckEngineChild() override;
 
   virtual bool DeallocPRemoteSpellcheckEngineChild(PRemoteSpellcheckEngineChild*) override;
 
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1387,27 +1387,39 @@ ContentParent::CreateContentBridgeParent
   return parent;
 }
 
 void
 ContentParent::GetAll(nsTArray<ContentParent*>& aArray)
 {
   aArray.Clear();
 
-  for (auto* cp : AllProcesses(eLive)) {
-    aArray.AppendElement(cp);
+  if (!sContentParents) {
+    return;
+  }
+
+  for (ContentParent* cp = sContentParents->getFirst(); cp;
+     cp = cp->LinkedListElement<ContentParent>::getNext()) {
+    if (cp->mIsAlive) {
+      aArray.AppendElement(cp);
+    }
   }
 }
 
 void
 ContentParent::GetAllEvenIfDead(nsTArray<ContentParent*>& aArray)
 {
   aArray.Clear();
 
-  for (auto* cp : AllProcesses(eAll)) {
+  if (!sContentParents) {
+    return;
+  }
+
+  for (ContentParent* cp = sContentParents->getFirst(); cp;
+     cp = cp->LinkedListElement<ContentParent>::getNext()) {
     aArray.AppendElement(cp);
   }
 }
 
 void
 ContentParent::Init()
 {
   nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
@@ -5095,24 +5107,27 @@ ContentParent::IgnoreIPCPrincipal()
                                  "dom.testing.ignore_ipc_principal", false);
   }
   return sIgnoreIPCPrincipal;
 }
 
 void
 ContentParent::NotifyUpdatedDictionaries()
 {
+  AutoTArray<ContentParent*, 8> processes;
+  GetAll(processes);
+
   nsCOMPtr<nsISpellChecker> spellChecker(do_GetService(NS_SPELLCHECKER_CONTRACTID));
   MOZ_ASSERT(spellChecker, "No spell checker?");
 
   InfallibleTArray<nsString> dictionaries;
   spellChecker->GetDictionaryList(&dictionaries);
 
-  for (auto* cp : AllProcesses(eLive)) {
-    Unused << cp->SendUpdateDictionaryList(dictionaries);
+  for (size_t i = 0; i < processes.Length(); ++i) {
+    Unused << processes[i]->SendUpdateDictionaryList(dictionaries);
   }
 }
 
 /*static*/ TabId
 ContentParent::AllocateTabId(const TabId& aOpenerTabId,
                              const IPCTabContext& aContext,
                              const ContentParentId& aCpId)
 {
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -157,71 +157,16 @@ public:
   CreateBrowserOrApp(const TabContext& aContext,
                      Element* aFrameElement,
                      ContentParent* aOpenerContentParent);
 
   static void GetAll(nsTArray<ContentParent*>& aArray);
 
   static void GetAllEvenIfDead(nsTArray<ContentParent*>& aArray);
 
-  enum CPIteratorPolicy {
-    eLive,
-    eAll
-  };
-
-  class ContentParentIterator {
-  private:
-    ContentParent* mCurrent;
-    CPIteratorPolicy mPolicy;
-
-  public:
-    ContentParentIterator(CPIteratorPolicy aPolicy, ContentParent* aCurrent)
-      : mCurrent(aCurrent),
-        mPolicy(aPolicy)
-    {
-    }
-
-    ContentParentIterator begin()
-    {
-      return *this;
-    }
-    ContentParentIterator end()
-    {
-      return ContentParentIterator(mPolicy, nullptr);
-    }
-
-    const ContentParentIterator& operator++()
-    {
-      MOZ_ASSERT(mCurrent);
-      do {
-        mCurrent = mCurrent->LinkedListElement<ContentParent>::getNext();
-      } while (mPolicy != eAll && mCurrent && !mCurrent->mIsAlive);
-
-      return *this;
-    }
-
-    bool operator!=(const ContentParentIterator& aOther)
-    {
-      MOZ_ASSERT(mPolicy == aOther.mPolicy);
-      return mCurrent != aOther.mCurrent;
-    }
-
-    ContentParent* operator*()
-    {
-      return mCurrent;
-    }
-  };
-
-  static ContentParentIterator AllProcesses(CPIteratorPolicy aPolicy)
-  {
-    ContentParent* first =
-      sContentParents ? sContentParents->getFirst() : nullptr;
-    return ContentParentIterator(aPolicy, first);
-  }
-
   static bool IgnoreIPCPrincipal();
 
   static void NotifyUpdatedDictionaries();
 
 #if defined(XP_WIN)
   /**
    * Windows helper for firing off an update window request to a plugin
    * instance.
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -515,18 +515,16 @@ child:
     async PTestShell();
 
     async PAPZ(TabId tabId);
 
     async RegisterChrome(ChromePackage[] packages, SubstitutionMapping[] substitutions,
                          OverrideMapping[] overrides, nsCString locale, bool reset);
     async RegisterChromeItem(ChromeRegistryItem item);
 
-    async ClearImageCache(bool privateLoader, bool chrome);
-
     async SetOffline(bool offline);
     async SetConnectivity(bool connectivity);
 
     async NotifyVisited(URIParams uri);
 
     async SystemMemoryAvailable(uint64_t getterId, uint32_t memoryAvailable);
 
     async PreferenceUpdate(PrefSetting pref);
--- a/image/imgLoader.cpp
+++ b/image/imgLoader.cpp
@@ -3,17 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/Attributes.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Move.h"
 #include "mozilla/Preferences.h"
-#include "mozilla/ChaosMode.h"
+ #include "mozilla/ChaosMode.h"
 
 #include "ImageLogging.h"
 #include "nsPrintfCString.h"
 #include "imgLoader.h"
 #include "imgRequestProxy.h"
 
 #include "nsCOMPtr.h"
 
@@ -31,17 +31,16 @@
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIProgressEventSink.h"
 #include "nsIChannelEventSink.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
 #include "nsIFileURL.h"
 #include "nsIFile.h"
 #include "nsCRT.h"
 #include "nsINetworkPredictor.h"
-#include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/nsMixedContentBlocker.h"
 
 #include "nsIApplicationCache.h"
 #include "nsIApplicationCacheContainer.h"
 
 #include "nsIMemoryReporter.h"
 #include "DecoderFactory.h"
 #include "Image.h"
@@ -52,17 +51,16 @@
 // so we can associate the document URI with the load group.
 // until this point, we have an evil hack:
 #include "nsIHttpChannelInternal.h"
 #include "nsILoadContext.h"
 #include "nsILoadGroupChild.h"
 #include "nsIDOMDocument.h"
 
 using namespace mozilla;
-using namespace mozilla::dom;
 using namespace mozilla::image;
 using namespace mozilla::net;
 
 MOZ_DEFINE_MALLOC_SIZE_OF(ImagesMallocSizeOf)
 
 class imgMemoryReporter final : public nsIMemoryReporter
 {
   ~imgMemoryReporter() { }
@@ -1337,23 +1335,16 @@ void imgLoader::ReadAcceptHeaderPref()
     mAcceptHeader =
         IMAGE_PNG "," IMAGE_WILDCARD ";q=0.8," ANY_WILDCARD ";q=0.5";
   }
 }
 
 NS_IMETHODIMP
 imgLoader::ClearCache(bool chrome)
 {
-  if (XRE_IsParentProcess()) {
-    bool privateLoader = this == gPrivateBrowsingLoader;
-    for (auto* cp : ContentParent::AllProcesses(ContentParent::eLive)) {
-      Unused << cp->SendClearImageCache(privateLoader, chrome);
-    }
-  }
-
   if (chrome) {
     return ClearChromeImageCache();
   } else {
     return ClearImageCache();
   }
 }
 
 NS_IMETHODIMP