diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp
index a624012f33..bd3775d828 100644
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -2081,7 +2081,6 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed& aNo
if (!gMediaElementEventsLog) {
gMediaElementEventsLog = PR_NewLogModule("nsMediaElementEvents");
}
- EnsureStateWatchingLog();
#endif
ErrorResult rv;
diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp
index 0d82462647..61bc9eed81 100644
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -116,10 +116,21 @@ public:
StaticRefPtr MediaMemoryTracker::sUniqueInstance;
+PRLogModuleInfo* gStateWatchingLog;
+PRLogModuleInfo* gMediaPromiseLog;
+PRLogModuleInfo* gMediaTimerLog;
+
void
MediaDecoder::InitStatics()
{
AbstractThread::InitStatics();
+
+ // Log modules.
+#ifdef PR_LOGGING
+ gMediaDecoderLog = PR_NewLogModule("MediaDecoder");
+#endif
+ gMediaPromiseLog = PR_NewLogModule("MediaPromise");
+ gStateWatchingLog = PR_NewLogModule("StateWatching");
}
NS_IMPL_ISUPPORTS(MediaMemoryTracker, nsIMemoryReporter)
@@ -611,12 +622,6 @@ MediaDecoder::MediaDecoder() :
MOZ_COUNT_CTOR(MediaDecoder);
MOZ_ASSERT(NS_IsMainThread());
MediaMemoryTracker::AddMediaDecoder(this);
-#ifdef PR_LOGGING
- if (!gMediaDecoderLog) {
- gMediaDecoderLog = PR_NewLogModule("MediaDecoder");
- }
- EnsureStateWatchingLog();
-#endif
// Initialize canonicals.
mPlayState.Init(AbstractThread::MainThread(), PLAY_STATE_LOADING, "MediaDecoder::mPlayState (Canonical)");
diff --git a/dom/media/MediaDecoderReader.cpp b/dom/media/MediaDecoderReader.cpp
index 19c50df0c3..ca1b452d5c 100644
--- a/dom/media/MediaDecoderReader.cpp
+++ b/dom/media/MediaDecoderReader.cpp
@@ -33,25 +33,6 @@ extern PRLogModuleInfo* gMediaDecoderLog;
#define DECODER_WARN(x, ...) \
DECODER_WARN_HELPER(0, (nsPrintfCString("Decoder=%p " x, mDecoder, ##__VA_ARGS__).get()))
-PRLogModuleInfo* gMediaPromiseLog;
-PRLogModuleInfo* gStateWatchingLog;
-
-void
-EnsureMediaPromiseLog()
-{
- if (!gMediaPromiseLog) {
- gMediaPromiseLog = PR_NewLogModule("MediaPromise");
- }
-}
-
-void
-EnsureStateWatchingLog()
-{
- if (!gStateWatchingLog) {
- gStateWatchingLog = PR_NewLogModule("StateWatching");
- }
-}
-
class VideoQueueMemoryFunctor : public nsDequeFunctor {
public:
VideoQueueMemoryFunctor() : mSize(0) {}
@@ -95,8 +76,6 @@ MediaDecoderReader::MediaDecoderReader(AbstractMediaDecoder* aDecoder)
, mVideoDiscontinuity(false)
{
MOZ_COUNT_CTOR(MediaDecoderReader);
- EnsureMediaPromiseLog();
- EnsureStateWatchingLog();
}
MediaDecoderReader::~MediaDecoderReader()
diff --git a/dom/media/StateWatching.h b/dom/media/StateWatching.h
index e0bcebfb24..001107a635 100644
--- a/dom/media/StateWatching.h
+++ b/dom/media/StateWatching.h
@@ -58,8 +58,6 @@ namespace mozilla {
extern PRLogModuleInfo* gStateWatchingLog;
-void EnsureStateWatchingLog();
-
#define WATCH_LOG(x, ...) \
MOZ_ASSERT(gStateWatchingLog); \
PR_LOG(gStateWatchingLog, PR_LOG_DEBUG, (x, ##__VA_ARGS__))