mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1151656 - Do static initialization explicitly. r=mattwoodrow
This commit is contained in:
parent
431df99c02
commit
b5df0b86c9
@ -38,16 +38,15 @@ AbstractThread::MainThread()
|
||||
}
|
||||
|
||||
void
|
||||
AbstractThread::EnsureMainThreadSingleton()
|
||||
AbstractThread::InitStatics()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!sMainThread) {
|
||||
nsCOMPtr<nsIThread> mainThread;
|
||||
NS_GetMainThread(getter_AddRefs(mainThread));
|
||||
MOZ_DIAGNOSTIC_ASSERT(mainThread);
|
||||
sMainThread = AbstractThread::Create(mainThread.get());
|
||||
ClearOnShutdown(&sMainThread);
|
||||
}
|
||||
MOZ_ASSERT(!sMainThread);
|
||||
nsCOMPtr<nsIThread> mainThread;
|
||||
NS_GetMainThread(getter_AddRefs(mainThread));
|
||||
MOZ_DIAGNOSTIC_ASSERT(mainThread);
|
||||
sMainThread = AbstractThread::Create(mainThread.get());
|
||||
ClearOnShutdown(&sMainThread);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -38,11 +38,10 @@ public:
|
||||
template<typename TargetType> static AbstractThread* Create(TargetType* aTarget);
|
||||
|
||||
// Convenience method for getting an AbstractThread for the main thread.
|
||||
//
|
||||
// EnsureMainThreadSingleton must be called on the main thread before any
|
||||
// other threads that might use MainThread() are spawned.
|
||||
static AbstractThread* MainThread();
|
||||
static void EnsureMainThreadSingleton();
|
||||
|
||||
// Must be called exactly once during startup.
|
||||
static void InitStatics();
|
||||
|
||||
protected:
|
||||
virtual ~AbstractThread() {}
|
||||
|
@ -117,6 +117,12 @@ public:
|
||||
|
||||
StaticRefPtr<MediaMemoryTracker> MediaMemoryTracker::sUniqueInstance;
|
||||
|
||||
void
|
||||
MediaDecoder::InitStatics()
|
||||
{
|
||||
AbstractThread::InitStatics();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(MediaMemoryTracker, nsIMemoryReporter)
|
||||
|
||||
NS_IMPL_ISUPPORTS(MediaDecoder, nsIObserver)
|
||||
@ -612,7 +618,6 @@ MediaDecoder::MediaDecoder() :
|
||||
MOZ_COUNT_CTOR(MediaDecoder);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MediaMemoryTracker::AddMediaDecoder(this);
|
||||
AbstractThread::EnsureMainThreadSingleton();
|
||||
#ifdef PR_LOGGING
|
||||
if (!gMediaDecoderLog) {
|
||||
gMediaDecoderLog = PR_NewLogModule("MediaDecoder");
|
||||
|
@ -298,6 +298,9 @@ public:
|
||||
PLAY_STATE_SHUTDOWN
|
||||
};
|
||||
|
||||
// Must be called exactly once, on the main thread, during startup.
|
||||
static void InitStatics();
|
||||
|
||||
MediaDecoder();
|
||||
|
||||
// Reset the decoder and notify the media element that
|
||||
|
@ -137,6 +137,7 @@ using namespace mozilla::system;
|
||||
#include "mozilla/dom/HTMLVideoElement.h"
|
||||
#include "CameraPreferences.h"
|
||||
#include "TouchManager.h"
|
||||
#include "MediaDecoder.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::net;
|
||||
@ -314,6 +315,8 @@ nsLayoutStatics::Initialize()
|
||||
mozilla::css::CommonAnimationManager::Initialize();
|
||||
#endif
|
||||
|
||||
MediaDecoder::InitStatics();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user