Skip to content

Commit

Permalink
Backed out 5 changesets (bug 1287623) for static build bustage CLOSED…
Browse files Browse the repository at this point in the history
… 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)
  • Loading branch information
KWierso committed Jul 20, 2016
1 parent ae7ba62 commit 0ae305d
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 71 deletions.
11 changes: 8 additions & 3 deletions dom/base/nsFrameMessageManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult)

nsDataHashtable<nsStringHashKey, nsMessageManagerScriptHolder*>*
nsMessageManagerScriptExecutor::sCachedScripts = nullptr;
StaticRefPtr<nsScriptCacheCleaner> nsMessageManagerScriptExecutor::sScriptCacheCleaner;
nsScriptCacheCleaner* nsMessageManagerScriptExecutor::sScriptCacheCleaner = nullptr;

void
nsMessageManagerScriptExecutor::DidCreateGlobal()
Expand All @@ -1672,7 +1672,10 @@ nsMessageManagerScriptExecutor::DidCreateGlobal()
if (!sCachedScripts) {
sCachedScripts =
new nsDataHashtable<nsStringHashKey, nsMessageManagerScriptHolder*>;
sScriptCacheCleaner = new nsScriptCacheCleaner();

RefPtr<nsScriptCacheCleaner> scriptCacheCleaner =
new nsScriptCacheCleaner();
scriptCacheCleaner.forget(&sScriptCacheCleaner);
}
}

Expand All @@ -1698,7 +1701,9 @@ nsMessageManagerScriptExecutor::Shutdown()

delete sCachedScripts;
sCachedScripts = nullptr;
sScriptCacheCleaner = nullptr;

RefPtr<nsScriptCacheCleaner> scriptCacheCleaner;
scriptCacheCleaner.swap(sScriptCacheCleaner);
}
}

Expand Down
3 changes: 1 addition & 2 deletions dom/base/nsFrameMessageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "nsDataHashtable.h"
#include "nsClassHashtable.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "nsIObserverService.h"
#include "nsThreadUtils.h"
#include "nsWeakPtr.h"
Expand Down Expand Up @@ -407,7 +406,7 @@ class nsMessageManagerScriptExecutor
AutoTArray<JS::Heap<JSObject*>, 2> mAnonymousGlobalScopes;

static nsDataHashtable<nsStringHashKey, nsMessageManagerScriptHolder*>* sCachedScripts;
static mozilla::StaticRefPtr<nsScriptCacheCleaner> sScriptCacheCleaner;
static nsScriptCacheCleaner* sScriptCacheCleaner;
};

class nsScriptCacheCleaner final : public nsIObserver
Expand Down
10 changes: 0 additions & 10 deletions mfbt/RefPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ 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.
Expand Down Expand Up @@ -149,10 +148,6 @@ class RefPtr
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>&
Expand Down Expand Up @@ -213,11 +208,6 @@ class RefPtr
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
Expand Down
11 changes: 6 additions & 5 deletions netwerk/cache2/CacheFileIOManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ class MetadataWriteScheduleEvent : public Runnable
}
};

StaticRefPtr<CacheFileIOManager> CacheFileIOManager::gInstance;
CacheFileIOManager * CacheFileIOManager::gInstance = nullptr;

NS_IMPL_ISUPPORTS(CacheFileIOManager, nsITimerCallback)

Expand Down Expand Up @@ -1130,7 +1130,7 @@ CacheFileIOManager::Init()
nsresult rv = ioMan->InitInternal();
NS_ENSURE_SUCCESS(rv, rv);

gInstance = ioMan.forget();
ioMan.swap(gInstance);
return NS_OK;
}

Expand All @@ -1154,7 +1154,7 @@ CacheFileIOManager::InitInternal()
nsresult
CacheFileIOManager::Shutdown()
{
LOG(("CacheFileIOManager::Shutdown() [gInstance=%p]", gInstance.get()));
LOG(("CacheFileIOManager::Shutdown() [gInstance=%p]", gInstance));

MOZ_ASSERT(NS_IsMainThread());

Expand Down Expand Up @@ -1185,7 +1185,8 @@ CacheFileIOManager::Shutdown()
gInstance->SyncRemoveAllCacheFiles();
}

gInstance = nullptr;
RefPtr<CacheFileIOManager> ioMan;
ioMan.swap(gInstance);

return NS_OK;
}
Expand Down Expand Up @@ -1258,7 +1259,7 @@ CacheFileIOManager::ShutdownInternal()
nsresult
CacheFileIOManager::OnProfile()
{
LOG(("CacheFileIOManager::OnProfile() [gInstance=%p]", gInstance.get()));
LOG(("CacheFileIOManager::OnProfile() [gInstance=%p]", gInstance));

RefPtr<CacheFileIOManager> ioMan = gInstance;
if (!ioMan) {
Expand Down
4 changes: 1 addition & 3 deletions netwerk/cache2/CacheFileIOManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#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"
Expand Down Expand Up @@ -442,8 +441,7 @@ class CacheFileIOManager : public nsITimerCallback
// 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.
Expand Down
11 changes: 6 additions & 5 deletions netwerk/cache2/CacheIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ NS_IMETHODIMP FileOpenHelper::OnFileOpened(CacheFileHandle *aHandle,
NS_IMPL_ISUPPORTS(FileOpenHelper, CacheFileIOListener);


StaticRefPtr<CacheIndex> CacheIndex::gInstance;
CacheIndex * CacheIndex::gInstance = nullptr;
StaticMutex CacheIndex::sLock;


Expand Down Expand Up @@ -289,7 +289,7 @@ CacheIndex::Init(nsIFile *aCacheDirectory)
nsresult rv = idx->InitInternal(aCacheDirectory);
NS_ENSURE_SUCCESS(rv, rv);

gInstance = idx.forget();
idx.swap(gInstance);
return NS_OK;
}

Expand All @@ -316,7 +316,7 @@ CacheIndex::PreShutdown()

StaticMutexAutoLock lock(sLock);

LOG(("CacheIndex::PreShutdown() [gInstance=%p]", gInstance.get()));
LOG(("CacheIndex::PreShutdown() [gInstance=%p]", gInstance));

nsresult rv;
RefPtr<CacheIndex> index = gInstance;
Expand Down Expand Up @@ -410,9 +410,10 @@ CacheIndex::Shutdown()

StaticMutexAutoLock lock(sLock);

LOG(("CacheIndex::Shutdown() [gInstance=%p]", gInstance.get()));
LOG(("CacheIndex::Shutdown() [gInstance=%p]", gInstance));

RefPtr<CacheIndex> index = gInstance.forget();
RefPtr<CacheIndex> index;
index.swap(gInstance);

if (!index) {
return NS_ERROR_NOT_INITIALIZED;
Expand Down
3 changes: 1 addition & 2 deletions netwerk/cache2/CacheIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "nsWeakReference.h"
#include "mozilla/SHA1.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/EndianUtils.h"
#include "mozilla/TimeStamp.h"

Expand Down Expand Up @@ -935,7 +934,7 @@ class CacheIndex : public CacheFileIOListener

void ReportHashStats();

static mozilla::StaticRefPtr<CacheIndex> gInstance;
static CacheIndex *gInstance;
static StaticMutex sLock;

nsCOMPtr<nsIFile> mCacheDirectory;
Expand Down
35 changes: 0 additions & 35 deletions xpcom/base/StaticPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
#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 {

Expand Down Expand Up @@ -112,26 +110,6 @@ class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS StaticRefPtr
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(); }
Expand Down Expand Up @@ -254,17 +232,4 @@ REFLEXIVE_EQUALITY_OPERATORS(const StaticRefPtr<T>&, StaticPtr_internal::Zero*,

} // 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
2 changes: 1 addition & 1 deletion xpcom/build/XPCOMInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ ShutdownXPCOM(nsIServiceManager* aServMgr)
}

// Release the directory service
nsDirectoryService::gService = nullptr;
NS_IF_RELEASE(nsDirectoryService::gService);

free(gGREBinPath);
gGREBinPath = nullptr;
Expand Down
8 changes: 5 additions & 3 deletions xpcom/io/nsDirectoryService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ nsDirectoryService::GetCurrentProcessDirectory(nsIFile** aFile)
return NS_ERROR_FAILURE;
} // GetCurrentProcessDirectory()

StaticRefPtr<nsDirectoryService> nsDirectoryService::gService;
nsDirectoryService* nsDirectoryService::gService = nullptr;

nsDirectoryService::nsDirectoryService()
: mHashtable(128)
Expand Down Expand Up @@ -243,13 +243,15 @@ 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()
Expand Down
3 changes: 1 addition & 2 deletions xpcom/io/nsDirectoryService.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#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
Expand Down Expand Up @@ -43,7 +42,7 @@ class nsDirectoryService final
static nsresult
Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);

static mozilla::StaticRefPtr<nsDirectoryService> gService;
static nsDirectoryService* gService;

private:
~nsDirectoryService();
Expand Down

0 comments on commit 0ae305d

Please sign in to comment.