Backed out 5 changesets (bug 1287623) for static build bustage CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Wed, 20 Jul 2016 15:40:33 -0700
changeset 348052 d2c17679b215bb340b1b8051c74526f6301c6253
parent 348051 236e2d22595cac5320a74e506b6cccd002e3d6b2
child 348053 e15ba82ad331a51115246616e490ce076b6f2271
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1287623
milestone50.0a1
backs outa48daec87ec9f637033e6ac7c1ed39d38aa177aa
248153344e15de4cb10a5d5829a24059a861fe98
8aa409c9b1ce3ebd68d5e6f970da64cf91d9d011
602d4d88e80608ad9e5af42ef4d7c7b3ffa99cf9
114da8bdc0b069fb2e8868e0b5e310f55a86bc35
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
Backed out 5 changesets (bug 1287623) for static build bustage CLOSED TREE Backed out changeset a48daec87ec9 (bug 1287623) Backed out changeset 248153344e15 (bug 1287623) Backed out changeset 8aa409c9b1ce (bug 1287623) Backed out changeset 602d4d88e806 (bug 1287623) Backed out changeset 114da8bdc0b0 (bug 1287623)
dom/base/nsFrameMessageManager.cpp
dom/base/nsFrameMessageManager.h
mfbt/RefPtr.h
netwerk/cache2/CacheFileIOManager.cpp
netwerk/cache2/CacheFileIOManager.h
netwerk/cache2/CacheIndex.cpp
netwerk/cache2/CacheIndex.h
xpcom/base/StaticPtr.h
xpcom/build/XPCOMInit.cpp
xpcom/io/nsDirectoryService.cpp
xpcom/io/nsDirectoryService.h
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -1658,26 +1658,29 @@ NS_NewGlobalMessageManager(nsIMessageBro
                                                                  MM_CHROME | MM_GLOBAL | MM_BROADCASTER);
   RegisterStrongMemoryReporter(new MessageManagerReporter());
   mm.forget(aResult);
   return NS_OK;
 }
 
 nsDataHashtable<nsStringHashKey, nsMessageManagerScriptHolder*>*
   nsMessageManagerScriptExecutor::sCachedScripts = nullptr;
-StaticRefPtr<nsScriptCacheCleaner> nsMessageManagerScriptExecutor::sScriptCacheCleaner;
+nsScriptCacheCleaner* nsMessageManagerScriptExecutor::sScriptCacheCleaner = nullptr;
 
 void
 nsMessageManagerScriptExecutor::DidCreateGlobal()
 {
   NS_ASSERTION(mGlobal, "Should have mGlobal!");
   if (!sCachedScripts) {
     sCachedScripts =
       new nsDataHashtable<nsStringHashKey, nsMessageManagerScriptHolder*>;
-    sScriptCacheCleaner = new nsScriptCacheCleaner();
+
+    RefPtr<nsScriptCacheCleaner> scriptCacheCleaner =
+      new nsScriptCacheCleaner();
+    scriptCacheCleaner.forget(&sScriptCacheCleaner);
   }
 }
 
 // static
 void
 nsMessageManagerScriptExecutor::PurgeCache()
 {
   if (sCachedScripts) {
@@ -1693,17 +1696,19 @@ nsMessageManagerScriptExecutor::PurgeCac
 void
 nsMessageManagerScriptExecutor::Shutdown()
 {
   if (sCachedScripts) {
     PurgeCache();
 
     delete sCachedScripts;
     sCachedScripts = nullptr;
-    sScriptCacheCleaner = nullptr;
+
+    RefPtr<nsScriptCacheCleaner> scriptCacheCleaner;
+    scriptCacheCleaner.swap(sScriptCacheCleaner);
   }
 }
 
 void
 nsMessageManagerScriptExecutor::LoadScriptInternal(const nsAString& aURL,
                                                    bool aRunInGlobalScope)
 {
   if (!mGlobal || !sCachedScripts) {
--- a/dom/base/nsFrameMessageManager.h
+++ b/dom/base/nsFrameMessageManager.h
@@ -16,17 +16,16 @@
 #include "nsIAtom.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsTArray.h"
 #include "nsIPrincipal.h"
 #include "nsIXPConnect.h"
 #include "nsDataHashtable.h"
 #include "nsClassHashtable.h"
 #include "mozilla/Services.h"
-#include "mozilla/StaticPtr.h"
 #include "nsIObserverService.h"
 #include "nsThreadUtils.h"
 #include "nsWeakPtr.h"
 #include "mozilla/Attributes.h"
 #include "js/RootingAPI.h"
 #include "nsTObserverArray.h"
 #include "mozilla/dom/SameProcessMessageQueue.h"
 #include "mozilla/dom/ipc/StructuredCloneData.h"
@@ -402,17 +401,17 @@ protected:
                                     bool aRunInGlobalScope);
   bool InitChildGlobalInternal(nsISupports* aScope, const nsACString& aID);
   void Trace(const TraceCallbacks& aCallbacks, void* aClosure);
   nsCOMPtr<nsIXPConnectJSObjectHolder> mGlobal;
   nsCOMPtr<nsIPrincipal> mPrincipal;
   AutoTArray<JS::Heap<JSObject*>, 2> mAnonymousGlobalScopes;
 
   static nsDataHashtable<nsStringHashKey, nsMessageManagerScriptHolder*>* sCachedScripts;
-  static mozilla::StaticRefPtr<nsScriptCacheCleaner> sScriptCacheCleaner;
+  static nsScriptCacheCleaner* sScriptCacheCleaner;
 };
 
 class nsScriptCacheCleaner final : public nsIObserver
 {
   ~nsScriptCacheCleaner() {}
 
   NS_DECL_ISUPPORTS
 
--- a/mfbt/RefPtr.h
+++ b/mfbt/RefPtr.h
@@ -14,17 +14,16 @@
 /*****************************************************************************/
 
 // template <class T> class RefPtrGetterAddRefs;
 
 class nsCOMPtr_helper;
 
 namespace mozilla {
 template<class T> class OwningNonNull;
-template<class T> class StaticRefPtr;
 
 // Traditionally, RefPtr supports automatic refcounting of any pointer type
 // with AddRef() and Release() methods that follow the traditional semantics.
 //
 // This traits class can be specialized to operate on other pointer types. For
 // example, we specialize this trait for opaque FFI types that represent
 // refcounted objects in Rust.
 //
@@ -144,20 +143,16 @@ public:
   }
 
   MOZ_IMPLICIT RefPtr(const nsCOMPtr_helper& aHelper);
 
   // Defined in OwningNonNull.h
   template<class U>
   MOZ_IMPLICIT RefPtr(const mozilla::OwningNonNull<U>& aOther);
 
-  // Defined in StaticPtr.h
-  template<class U>
-  MOZ_IMPLICIT RefPtr(const mozilla::StaticRefPtr<U>& aOther);
-
   // Assignment operators
 
   RefPtr<T>&
   operator=(const RefPtr<T>& aRhs)
   // copy assignment operator
   {
     assign_with_AddRef(aRhs.mRawPtr);
     return *this;
@@ -208,21 +203,16 @@ public:
     return *this;
   }
 
   // Defined in OwningNonNull.h
   template<class U>
   RefPtr<T>&
   operator=(const mozilla::OwningNonNull<U>& aOther);
 
-  // Defined in StaticPtr.h
-  template<class U>
-  RefPtr<T>&
-  operator=(const mozilla::StaticRefPtr<U>& aOther);
-
   // Other pointer operators
 
   void
   swap(RefPtr<T>& aRhs)
   // ...exchange ownership with |aRhs|; can save a pair of refcount operations
   {
     T* temp = aRhs.mRawPtr;
     aRhs.mRawPtr = mRawPtr;
--- a/netwerk/cache2/CacheFileIOManager.cpp
+++ b/netwerk/cache2/CacheFileIOManager.cpp
@@ -1087,17 +1087,17 @@ public:
     case SHUTDOWN:
       ioMan->ShutdownMetadataWriteSchedulingInternal();
       break;
     }
     return NS_OK;
   }
 };
 
-StaticRefPtr<CacheFileIOManager> CacheFileIOManager::gInstance;
+CacheFileIOManager * CacheFileIOManager::gInstance = nullptr;
 
 NS_IMPL_ISUPPORTS(CacheFileIOManager, nsITimerCallback)
 
 CacheFileIOManager::CacheFileIOManager()
   : mShuttingDown(false)
   , mTreeCreated(false)
   , mOverLimitEvicting(false)
   , mRemovingTrashDirs(false)
@@ -1125,17 +1125,17 @@ CacheFileIOManager::Init()
     return NS_ERROR_ALREADY_INITIALIZED;
   }
 
   RefPtr<CacheFileIOManager> ioMan = new CacheFileIOManager();
 
   nsresult rv = ioMan->InitInternal();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  gInstance = ioMan.forget();
+  ioMan.swap(gInstance);
   return NS_OK;
 }
 
 nsresult
 CacheFileIOManager::InitInternal()
 {
   nsresult rv;
 
@@ -1149,17 +1149,17 @@ CacheFileIOManager::InitInternal()
 
   return NS_OK;
 }
 
 // static
 nsresult
 CacheFileIOManager::Shutdown()
 {
-  LOG(("CacheFileIOManager::Shutdown() [gInstance=%p]", gInstance.get()));
+  LOG(("CacheFileIOManager::Shutdown() [gInstance=%p]", gInstance));
 
   MOZ_ASSERT(NS_IsMainThread());
 
   if (!gInstance) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE_SHUTDOWN_V2> shutdownTimer;
@@ -1180,17 +1180,18 @@ CacheFileIOManager::Shutdown()
 
   CacheIndex::Shutdown();
 
   if (CacheObserver::ClearCacheOnShutdown()) {
     Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE2_SHUTDOWN_CLEAR_PRIVATE> totalTimer;
     gInstance->SyncRemoveAllCacheFiles();
   }
 
-  gInstance = nullptr;
+  RefPtr<CacheFileIOManager> ioMan;
+  ioMan.swap(gInstance);
 
   return NS_OK;
 }
 
 nsresult
 CacheFileIOManager::ShutdownInternal()
 {
   LOG(("CacheFileIOManager::ShutdownInternal() [this=%p]", this));
@@ -1253,17 +1254,17 @@ CacheFileIOManager::ShutdownInternal()
 
   return NS_OK;
 }
 
 // static
 nsresult
 CacheFileIOManager::OnProfile()
 {
-  LOG(("CacheFileIOManager::OnProfile() [gInstance=%p]", gInstance.get()));
+  LOG(("CacheFileIOManager::OnProfile() [gInstance=%p]", gInstance));
 
   RefPtr<CacheFileIOManager> ioMan = gInstance;
   if (!ioMan) {
     // CacheFileIOManager::Init() failed, probably could not create the IO
     // thread, just go with it...
     return NS_ERROR_NOT_INITIALIZED;
   }
 
--- a/netwerk/cache2/CacheFileIOManager.h
+++ b/netwerk/cache2/CacheFileIOManager.h
@@ -7,17 +7,16 @@
 
 #include "CacheIOThread.h"
 #include "CacheStorageService.h"
 #include "nsIEventTarget.h"
 #include "nsITimer.h"
 #include "nsCOMPtr.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/SHA1.h"
-#include "mozilla/StaticPtr.h"
 #include "mozilla/TimeStamp.h"
 #include "nsTArray.h"
 #include "nsString.h"
 #include "nsTHashtable.h"
 #include "prio.h"
 
 //#define DEBUG_HANDLES 1
 
@@ -437,18 +436,17 @@ private:
   // It is called in EvictIfOverLimitInternal() just before we decide whether to
   // start overlimit eviction or not and also in OverLimitEvictionInternal()
   // before we start an eviction loop.
   nsresult UpdateSmartCacheSize(int64_t aFreeSpace);
 
   // Memory reporting (private part)
   size_t SizeOfExcludingThisInternal(mozilla::MallocSizeOf mallocSizeOf) const;
 
-  static StaticRefPtr<CacheFileIOManager> gInstance;
-
+  static CacheFileIOManager           *gInstance;
   TimeStamp                            mStartTime;
   // Set true on the IO thread, CLOSE level as part of the internal shutdown
   // procedure.
   bool                                 mShuttingDown;
   RefPtr<CacheIOThread>                mIOThread;
   nsCOMPtr<nsIFile>                    mCacheDirectory;
 #if defined(MOZ_WIDGET_ANDROID)
   // On Android we add the active profile directory name between the path
--- a/netwerk/cache2/CacheIndex.cpp
+++ b/netwerk/cache2/CacheIndex.cpp
@@ -218,17 +218,17 @@ NS_IMETHODIMP FileOpenHelper::OnFileOpen
   mIndex->OnFileOpenedInternal(this, aHandle, aResult);
 
   return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS(FileOpenHelper, CacheFileIOListener);
 
 
-StaticRefPtr<CacheIndex> CacheIndex::gInstance;
+CacheIndex * CacheIndex::gInstance = nullptr;
 StaticMutex  CacheIndex::sLock;
 
 
 NS_IMPL_ADDREF(CacheIndex)
 NS_IMPL_RELEASE(CacheIndex)
 
 NS_INTERFACE_MAP_BEGIN(CacheIndex)
   NS_INTERFACE_MAP_ENTRY(mozilla::net::CacheFileIOListener)
@@ -284,17 +284,17 @@ CacheIndex::Init(nsIFile *aCacheDirector
     return NS_ERROR_ALREADY_INITIALIZED;
   }
 
   RefPtr<CacheIndex> idx = new CacheIndex();
 
   nsresult rv = idx->InitInternal(aCacheDirectory);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  gInstance = idx.forget();
+  idx.swap(gInstance);
   return NS_OK;
 }
 
 nsresult
 CacheIndex::InitInternal(nsIFile *aCacheDirectory)
 {
   nsresult rv;
 
@@ -311,17 +311,17 @@ CacheIndex::InitInternal(nsIFile *aCache
 // static
 nsresult
 CacheIndex::PreShutdown()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   StaticMutexAutoLock lock(sLock);
 
-  LOG(("CacheIndex::PreShutdown() [gInstance=%p]", gInstance.get()));
+  LOG(("CacheIndex::PreShutdown() [gInstance=%p]", gInstance));
 
   nsresult rv;
   RefPtr<CacheIndex> index = gInstance;
 
   if (!index) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
@@ -405,19 +405,20 @@ CacheIndex::PreShutdownInternal()
 // static
 nsresult
 CacheIndex::Shutdown()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   StaticMutexAutoLock lock(sLock);
 
-  LOG(("CacheIndex::Shutdown() [gInstance=%p]", gInstance.get()));
-
-  RefPtr<CacheIndex> index = gInstance.forget();
+  LOG(("CacheIndex::Shutdown() [gInstance=%p]", gInstance));
+
+  RefPtr<CacheIndex> index;
+  index.swap(gInstance);
 
   if (!index) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   bool sanitize = CacheObserver::ClearCacheOnShutdown();
 
   LOG(("CacheIndex::Shutdown() - [state=%d, indexOnDiskIsValid=%d, "
--- a/netwerk/cache2/CacheIndex.h
+++ b/netwerk/cache2/CacheIndex.h
@@ -12,17 +12,16 @@
 #include "nsICacheStorageService.h"
 #include "nsICacheEntry.h"
 #include "nsILoadContextInfo.h"
 #include "nsTHashtable.h"
 #include "nsThreadUtils.h"
 #include "nsWeakReference.h"
 #include "mozilla/SHA1.h"
 #include "mozilla/StaticMutex.h"
-#include "mozilla/StaticPtr.h"
 #include "mozilla/EndianUtils.h"
 #include "mozilla/TimeStamp.h"
 
 class nsIFile;
 class nsIDirectoryEnumerator;
 class nsITimer;
 
 
@@ -930,17 +929,17 @@ private:
   void ReplaceRecordInIterators(CacheIndexRecord *aOldRecord,
                                 CacheIndexRecord *aNewRecord);
 
   // Memory reporting (private part)
   size_t SizeOfExcludingThisInternal(mozilla::MallocSizeOf mallocSizeOf) const;
 
   void ReportHashStats();
 
-  static mozilla::StaticRefPtr<CacheIndex> gInstance;
+  static CacheIndex *gInstance;
   static StaticMutex sLock;
 
   nsCOMPtr<nsIFile> mCacheDirectory;
 
   EState         mState;
   // Timestamp of time when the index was initialized. We use it to delay
   // initial update or build of index.
   TimeStamp      mStartTime;
--- a/xpcom/base/StaticPtr.h
+++ b/xpcom/base/StaticPtr.h
@@ -2,20 +2,18 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef mozilla_StaticPtr_h
 #define mozilla_StaticPtr_h
 
-#include "mozilla/AlreadyAddRefed.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
-#include "mozilla/RefPtr.h"
 
 namespace mozilla {
 
 /**
  * StaticAutoPtr and StaticRefPtr are like nsAutoPtr and nsRefPtr, except they
  * are suitable for use as global variables.
  *
  * In particular, a global instance of Static{Auto,Ref}Ptr doesn't cause the
@@ -107,36 +105,16 @@ public:
     return *this;
   }
 
   StaticRefPtr<T>& operator=(const StaticRefPtr<T>& aRhs)
   {
     return (this = aRhs.mRawPtr);
   }
 
-  StaticRefPtr<T>& operator=(already_AddRefed<T>& aRhs)
-  {
-    AssignAssumingAddRef(aRhs.take());
-    return *this;
-  }
-
-  StaticRefPtr<T>& operator=(already_AddRefed<T>&& aRhs)
-  {
-    AssignAssumingAddRef(aRhs.take());
-    return *this;
-  }
-
-  already_AddRefed<T>
-  forget()
-  {
-    T* temp = mRawPtr;
-    mRawPtr = nullptr;
-    return already_AddRefed<T>(temp);
-  }
-
   T* get() const { return mRawPtr; }
 
   operator T*() const { return get(); }
 
   T* operator->() const
   {
     MOZ_ASSERT(mRawPtr);
     return get();
@@ -249,22 +227,9 @@ REFLEXIVE_EQUALITY_OPERATORS(const Stati
 // Let us compare StaticRefPtr to 0.
 REFLEXIVE_EQUALITY_OPERATORS(const StaticRefPtr<T>&, StaticPtr_internal::Zero*,
                              lhs.get() == nullptr, class T)
 
 #undef REFLEXIVE_EQUALITY_OPERATORS
 
 } // namespace mozilla
 
-// Declared in mozilla/RefPtr.h
-template<class T> template<class U>
-RefPtr<T>::RefPtr(const mozilla::StaticRefPtr<U>& aOther)
-  : RefPtr(aOther.get())
-{}
-
-template<class T> template<class U>
-RefPtr<T>&
-RefPtr<T>::operator=(const mozilla::StaticRefPtr<U>& aOther)
-{
-  return operator=(aOther.get());
-}
-
 #endif
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -930,17 +930,17 @@ ShutdownXPCOM(nsIServiceManager* aServMg
   NS_IF_RELEASE(aServMgr);
 
   // Shutdown global servicemanager
   if (nsComponentManagerImpl::gComponentManager) {
     nsComponentManagerImpl::gComponentManager->FreeServices();
   }
 
   // Release the directory service
-  nsDirectoryService::gService = nullptr;
+  NS_IF_RELEASE(nsDirectoryService::gService);
 
   free(gGREBinPath);
   gGREBinPath = nullptr;
 
   if (moduleLoaders) {
     bool more;
     nsCOMPtr<nsISupports> el;
     while (NS_SUCCEEDED(moduleLoaders->HasMoreElements(&more)) && more) {
--- a/xpcom/io/nsDirectoryService.cpp
+++ b/xpcom/io/nsDirectoryService.cpp
@@ -187,17 +187,17 @@ nsDirectoryService::GetCurrentProcessDir
   }
 
 #endif
 
   NS_ERROR("unable to get current process directory");
   return NS_ERROR_FAILURE;
 } // GetCurrentProcessDirectory()
 
-StaticRefPtr<nsDirectoryService> nsDirectoryService::gService;
+nsDirectoryService* nsDirectoryService::gService = nullptr;
 
 nsDirectoryService::nsDirectoryService()
   : mHashtable(128)
 {
 }
 
 nsresult
 nsDirectoryService::Create(nsISupports* aOuter, REFNSIID aIID, void** aResult)
@@ -238,23 +238,25 @@ nsDirectoryService::Init()
 }
 
 void
 nsDirectoryService::RealInit()
 {
   NS_ASSERTION(!gService,
                "nsDirectoryService::RealInit Mustn't initialize twice!");
 
-  gService = new nsDirectoryService();
+  RefPtr<nsDirectoryService> self = new nsDirectoryService();
 
   NS_RegisterStaticAtoms(directory_atoms);
 
   // Let the list hold the only reference to the provider.
   nsAppFileLocationProvider* defaultProvider = new nsAppFileLocationProvider;
-  gService->mProviders.AppendElement(defaultProvider);
+  self->mProviders.AppendElement(defaultProvider);
+
+  self.swap(gService);
 }
 
 nsDirectoryService::~nsDirectoryService()
 {
 }
 
 NS_IMPL_ISUPPORTS(nsDirectoryService,
                   nsIProperties,
--- a/xpcom/io/nsDirectoryService.h
+++ b/xpcom/io/nsDirectoryService.h
@@ -8,17 +8,16 @@
 #define nsDirectoryService_h___
 
 #include "nsIDirectoryService.h"
 #include "nsInterfaceHashtable.h"
 #include "nsIFile.h"
 #include "nsIAtom.h"
 #include "nsTArray.h"
 #include "mozilla/Attributes.h"
-#include "mozilla/StaticPtr.h"
 
 #define NS_XPCOM_INIT_CURRENT_PROCESS_DIR       "MozBinD"   // Can be used to set NS_XPCOM_CURRENT_PROCESS_DIR
                                                             // CANNOT be used to GET a location
 #define NS_DIRECTORY_SERVICE_CID  {0xf00152d0,0xb40b,0x11d3,{0x8c, 0x9c, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
 
 class nsDirectoryService final
   : public nsIDirectoryService
   , public nsIProperties
@@ -38,17 +37,17 @@ public:
   nsDirectoryService();
 
   static void RealInit();
   void RegisterCategoryProviders();
 
   static nsresult
   Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
 
-  static mozilla::StaticRefPtr<nsDirectoryService> gService;
+  static nsDirectoryService* gService;
 
 private:
   ~nsDirectoryService();
 
   nsresult GetCurrentProcessDirectory(nsIFile** aFile);
 
   nsInterfaceHashtable<nsCStringHashKey, nsIFile> mHashtable;
   nsTArray<nsCOMPtr<nsIDirectoryServiceProvider>> mProviders;