From 3cbe348cddc5f335cce44240d1fa3980269df6e9 Mon Sep 17 00:00:00 2001 From: sajitk Date: Wed, 11 Nov 2015 06:52:00 +0100 Subject: [PATCH] Bug 1219480 - Replace PRLogModuleInfo with LazyLogModule in the media directory. r=rillian --HG-- extra : rebase_source : c73098485fa005d914304fb6e7f8eba3c15e66dc --- dom/media/AudioStream.cpp | 2 +- dom/media/CubebUtils.cpp | 3 +-- dom/media/DOMMediaStream.cpp | 10 +++------- dom/media/GraphDriver.cpp | 2 +- dom/media/Latency.cpp | 10 ++++------ dom/media/Latency.h | 2 +- dom/media/MP3Demuxer.cpp | 8 +------- dom/media/MediaCache.cpp | 6 +----- dom/media/MediaDecoder.cpp | 13 +++---------- dom/media/MediaDecoderReader.cpp | 2 +- dom/media/MediaDecoderStateMachine.h | 4 ++-- dom/media/MediaFormatReader.cpp | 13 ++++--------- dom/media/MediaManager.cpp | 6 ++---- dom/media/MediaManager.h | 2 +- dom/media/MediaRecorder.cpp | 10 +++------- dom/media/MediaResource.cpp | 5 +---- dom/media/MediaShutdownManager.cpp | 2 +- dom/media/MediaStreamGraph.cpp | 6 +----- dom/media/MediaStreamGraph.h | 2 +- dom/media/MediaTimer.h | 2 +- dom/media/RtspMediaResource.cpp | 5 +---- dom/media/StreamBuffer.cpp | 2 +- dom/media/TrackUnionStream.cpp | 5 +---- dom/media/WebVTTListener.cpp | 5 +---- dom/media/apple/AppleMP3Reader.cpp | 2 +- dom/media/directshow/AudioSinkFilter.cpp | 2 +- dom/media/directshow/AudioSinkInputPin.cpp | 2 +- dom/media/directshow/DirectShowReader.cpp | 8 ++------ dom/media/directshow/SampleSink.cpp | 2 +- dom/media/directshow/SourceFilter.cpp | 2 +- dom/media/eme/EMEUtils.cpp | 14 ++++---------- dom/media/eme/EMEUtils.h | 4 ++-- dom/media/encoder/MediaEncoder.cpp | 5 +---- dom/media/encoder/TrackEncoder.cpp | 5 +---- dom/media/encoder/VP8TrackEncoder.cpp | 5 +---- dom/media/encoder/VorbisTrackEncoder.cpp | 5 +---- dom/media/fmp4/MP4Demuxer.cpp | 7 ++----- dom/media/gmp/GMPAudioDecoderParent.cpp | 2 +- dom/media/gmp/GMPChild.cpp | 2 +- dom/media/gmp/GMPContentParent.cpp | 2 +- dom/media/gmp/GMPDecryptorParent.cpp | 2 +- dom/media/gmp/GMPParent.cpp | 2 +- dom/media/gmp/GMPService.cpp | 6 ++---- dom/media/gmp/GMPService.h | 2 +- dom/media/gmp/GMPStorageParent.cpp | 2 +- dom/media/gmp/GMPTimerParent.cpp | 2 +- dom/media/gmp/GMPVideoDecoderParent.cpp | 2 +- dom/media/gmp/GMPVideoEncoderParent.cpp | 2 +- dom/media/gstreamer/GStreamerFormatHelper.cpp | 2 +- dom/media/gstreamer/GStreamerReader.cpp | 2 +- dom/media/imagecapture/ImageCapture.cpp | 7 ++----- dom/media/imagecapture/ImageCapture.h | 2 +- dom/media/mediasink/DecodedAudioDataSink.cpp | 2 +- dom/media/mediasink/VideoSink.cpp | 2 +- dom/media/mediasource/ContainerParser.cpp | 2 +- dom/media/mediasource/MediaSource.cpp | 14 ++++---------- dom/media/mediasource/MediaSourceDecoder.cpp | 2 +- dom/media/mediasource/MediaSourceResource.h | 2 +- dom/media/mediasource/ResourceQueue.cpp | 2 +- dom/media/mediasource/SourceBuffer.cpp | 4 ++-- dom/media/mediasource/SourceBufferList.cpp | 4 ++-- dom/media/mediasource/SourceBufferResource.cpp | 7 ++----- dom/media/mediasource/TrackBuffersManager.cpp | 9 +++------ dom/media/ogg/OggCodecState.cpp | 2 +- dom/media/ogg/OggReader.cpp | 2 +- dom/media/ogg/OpusParser.cpp | 2 +- dom/media/omx/AudioOffloadPlayer.cpp | 6 +----- dom/media/omx/AudioOutput.cpp | 5 +---- dom/media/omx/I420ColorConverterHelper.cpp | 5 +---- dom/media/omx/MediaOmxCommonDecoder.cpp | 2 +- dom/media/omx/MediaOmxCommonReader.cpp | 2 +- dom/media/omx/MediaOmxReader.cpp | 2 +- dom/media/omx/OmxDecoder.cpp | 6 +----- dom/media/platforms/PlatformDecoderModule.cpp | 7 ++----- dom/media/platforms/agnostic/OpusDecoder.cpp | 2 +- dom/media/platforms/agnostic/VPXDecoder.cpp | 2 +- dom/media/platforms/agnostic/VorbisDecoder.cpp | 2 +- dom/media/platforms/apple/AppleATDecoder.cpp | 2 +- dom/media/platforms/apple/AppleCMLinker.cpp | 2 +- dom/media/platforms/apple/AppleVDADecoder.cpp | 2 +- dom/media/platforms/apple/AppleVDALinker.cpp | 2 +- dom/media/platforms/apple/AppleVTDecoder.cpp | 2 +- dom/media/platforms/apple/AppleVTLinker.cpp | 2 +- dom/media/platforms/ffmpeg/FFmpegLog.h | 2 +- .../platforms/gonk/GonkAudioDecoderManager.cpp | 2 +- dom/media/platforms/gonk/GonkMediaDataDecoder.cpp | 2 +- .../platforms/gonk/GonkVideoDecoderManager.cpp | 2 +- dom/media/platforms/wmf/MFTDecoder.cpp | 2 +- dom/media/platforms/wmf/WMFAudioMFTManager.cpp | 2 +- dom/media/platforms/wmf/WMFMediaDataDecoder.cpp | 2 +- dom/media/platforms/wmf/WMFVideoMFTManager.cpp | 2 +- dom/media/platforms/wrappers/FuzzingWrapper.cpp | 7 ++----- dom/media/systemservices/CamerasChild.cpp | 13 +------------ dom/media/systemservices/CamerasParent.cpp | 5 +---- dom/media/systemservices/LoadManager.cpp | 4 +--- dom/media/systemservices/LoadManager.h | 2 +- dom/media/systemservices/MediaChild.cpp | 5 +---- dom/media/systemservices/MediaParent.cpp | 4 +--- dom/media/systemservices/OpenSLESProvider.cpp | 4 +--- dom/media/systemservices/OpenSLESProvider.h | 2 +- dom/media/systemservices/ShmemPool.cpp | 2 +- dom/media/wave/WaveReader.cpp | 2 +- dom/media/webm/AudioDecoder.cpp | 2 +- dom/media/webm/WebMDemuxer.cpp | 10 ++-------- dom/media/webm/WebMReader.cpp | 7 ++----- dom/media/webrtc/MediaEngineCameraVideoSource.cpp | 2 +- dom/media/webrtc/MediaEngineGonkVideoSource.cpp | 2 +- dom/media/webrtc/MediaEngineRemoteVideoSource.cpp | 2 +- dom/media/webrtc/MediaEngineWebRTC.cpp | 6 ++---- dom/media/webrtc/MediaEngineWebRTCAudio.cpp | 2 +- .../webspeech/recognition/SpeechRecognition.cpp | 8 ++------ .../webspeech/recognition/SpeechRecognition.h | 2 +- dom/media/webspeech/synth/SpeechSynthesis.cpp | 8 ++------ dom/media/webspeech/synth/nsSpeechTask.cpp | 2 +- dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp | 2 +- media/libstagefright/binding/MoofParser.cpp | 2 +- .../src/media-conduit/WebrtcGmpVideoCodec.cpp | 2 +- 117 files changed, 154 insertions(+), 309 deletions(-) diff --git a/dom/media/AudioStream.cpp b/dom/media/AudioStream.cpp index 2277b37b5cd5..93cf584d1be2 100644 --- a/dom/media/AudioStream.cpp +++ b/dom/media/AudioStream.cpp @@ -25,7 +25,7 @@ namespace mozilla { #undef LOG #endif -PRLogModuleInfo* gAudioStreamLog = nullptr; +LazyLogModule gAudioStreamLog("AudioStream"); // For simple logs #define LOG(x) MOZ_LOG(gAudioStreamLog, mozilla::LogLevel::Debug, x) diff --git a/dom/media/CubebUtils.cpp b/dom/media/CubebUtils.cpp index 59e03ac10223..d9cfcc19dcf5 100644 --- a/dom/media/CubebUtils.cpp +++ b/dom/media/CubebUtils.cpp @@ -40,7 +40,7 @@ uint32_t sPreferredSampleRate; } // namespace -extern PRLogModuleInfo* gAudioStreamLog; +extern LazyLogModule gAudioStreamLog; static const uint32_t CUBEB_NORMAL_LATENCY_MS = 100; @@ -126,7 +126,6 @@ bool CubebLatencyPrefSet() void InitLibrary() { - gAudioStreamLog = PR_NewLogModule("AudioStream"); PrefChanged(PREF_VOLUME_SCALE, nullptr); Preferences::RegisterCallback(PrefChanged, PREF_VOLUME_SCALE); PrefChanged(PREF_CUBEB_LATENCY, nullptr); diff --git a/dom/media/DOMMediaStream.cpp b/dom/media/DOMMediaStream.cpp index 08a700927cd2..ca4e9ea53872 100644 --- a/dom/media/DOMMediaStream.cpp +++ b/dom/media/DOMMediaStream.cpp @@ -27,13 +27,13 @@ #undef LOG #endif -static PRLogModuleInfo* gMediaStreamLog; -#define LOG(type, msg) MOZ_LOG(gMediaStreamLog, type, msg) - using namespace mozilla; using namespace mozilla::dom; using namespace mozilla::layers; +static LazyLogModule gMediaStreamLog("MediaStream"); +#define LOG(type, msg) MOZ_LOG(gMediaStreamLog, type, msg) + const TrackID TRACK_VIDEO_PRIMARY = 1; @@ -318,10 +318,6 @@ DOMMediaStream::DOMMediaStream() nsCOMPtr uuidgen = do_GetService("@mozilla.org/uuid-generator;1", &rv); - if (!gMediaStreamLog) { - gMediaStreamLog = PR_NewLogModule("MediaStream"); - } - if (NS_SUCCEEDED(rv) && uuidgen) { nsID uuid; memset(&uuid, 0, sizeof(uuid)); diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index 4479ca5129a6..e3cdacad5bb0 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -10,7 +10,7 @@ #include #endif -extern PRLogModuleInfo* gMediaStreamGraphLog; +extern mozilla::LazyLogModule gMediaStreamGraphLog; #define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg) // We don't use NSPR log here because we want this interleaved with adb logcat diff --git a/dom/media/Latency.cpp b/dom/media/Latency.cpp index 870bc99c98a5..d3400777ad0f 100644 --- a/dom/media/Latency.cpp +++ b/dom/media/Latency.cpp @@ -37,17 +37,13 @@ const char* LatencyLogIndex2Strings[] = { static StaticRefPtr gAsyncLogger; -PRLogModuleInfo* +LogModule* GetLatencyLog() { - static PRLogModuleInfo* sLog; - if (!sLog) { - sLog = PR_NewLogModule("MediaLatency"); - } + static LazyLogModule sLog("MediaLatency"); return sLog; } - class LogEvent : public nsRunnable { public: @@ -111,6 +107,8 @@ void LogLatency(uint32_t aIndex, uint64_t aID, int64_t aValue) void AsyncLatencyLogger::InitializeStatics() { NS_ASSERTION(NS_IsMainThread(), "Main thread only"); + + //Make sure that the underlying logger is allocated. GetLatencyLog(); gAsyncLogger = new AsyncLatencyLogger(); } diff --git a/dom/media/Latency.h b/dom/media/Latency.h index e7a83d78b8cf..b86ee7b54b21 100644 --- a/dom/media/Latency.h +++ b/dom/media/Latency.h @@ -17,7 +17,7 @@ class AsyncLatencyLogger; -PRLogModuleInfo* GetLatencyLog(); +mozilla::LogModule* GetLatencyLog(); // This class is a singleton. It is refcounted. class AsyncLatencyLogger : public nsIObserver diff --git a/dom/media/MP3Demuxer.cpp b/dom/media/MP3Demuxer.cpp index d3a9c4dcfd78..f7ce9ae7011c 100644 --- a/dom/media/MP3Demuxer.cpp +++ b/dom/media/MP3Demuxer.cpp @@ -16,7 +16,7 @@ #include "prenv.h" #ifdef PR_LOGGING -PRLogModuleInfo* gMP3DemuxerLog; +mozilla::LazyLogModule gMP3DemuxerLog("MP3Demuxer"); #define MP3LOG(msg, ...) \ MOZ_LOG(gMP3DemuxerLog, LogLevel::Debug, ("MP3Demuxer " msg, ##__VA_ARGS__)) #define MP3LOGV(msg, ...) \ @@ -112,12 +112,6 @@ MP3TrackDemuxer::MP3TrackDemuxer(MediaResource* aSource) , mChannels(0) { Reset(); - -#ifdef PR_LOGGING - if (!gMP3DemuxerLog) { - gMP3DemuxerLog = PR_NewLogModule("MP3Demuxer"); - } -#endif } bool diff --git a/dom/media/MediaCache.cpp b/dom/media/MediaCache.cpp index da69a7e00f66..ce39cce3d91c 100644 --- a/dom/media/MediaCache.cpp +++ b/dom/media/MediaCache.cpp @@ -24,7 +24,7 @@ namespace mozilla { -PRLogModuleInfo* gMediaCacheLog; +LazyLogModule gMediaCacheLog("MediaCache"); #define CACHE_LOG(type, msg) MOZ_LOG(gMediaCacheLog, type, msg) // Readahead blocks for non-seekable streams will be limited to this @@ -580,10 +580,6 @@ MediaCache::Init() rv = mFileCache->Open(fileDesc); NS_ENSURE_SUCCESS(rv,rv); - if (!gMediaCacheLog) { - gMediaCacheLog = PR_NewLogModule("MediaCache"); - } - MediaCacheFlusher::Init(); return NS_OK; diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index c9b676dae689..1b6aef466127 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -46,7 +46,7 @@ static const uint64_t ESTIMATED_DURATION_FUZZ_FACTOR_USECS = USECS_PER_S / 2; // avoid redefined macro in unified build #undef DECODER_LOG -PRLogModuleInfo* gMediaDecoderLog; +LazyLogModule gMediaDecoderLog("MediaDecoder"); #define DECODER_LOG(x, ...) \ MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("Decoder=%p " x, this, ##__VA_ARGS__)) @@ -113,21 +113,14 @@ public: StaticRefPtr MediaMemoryTracker::sUniqueInstance; #if defined(PR_LOGGING) -PRLogModuleInfo* gMediaTimerLog; -PRLogModuleInfo* gMediaSampleLog; +LazyLogModule gMediaTimerLog("MediaTimer"); +LazyLogModule gMediaSampleLog("MediaSample"); #endif void MediaDecoder::InitStatics() { MOZ_ASSERT(NS_IsMainThread()); - -#if defined(PR_LOGGING) - // Log modules. - gMediaDecoderLog = PR_NewLogModule("MediaDecoder"); - gMediaTimerLog = PR_NewLogModule("MediaTimer"); - gMediaSampleLog = PR_NewLogModule("MediaSample"); -#endif } NS_IMPL_ISUPPORTS(MediaMemoryTracker, nsIMemoryReporter) diff --git a/dom/media/MediaDecoderReader.cpp b/dom/media/MediaDecoderReader.cpp index 402c72f0fab7..7b958e31bdd2 100644 --- a/dom/media/MediaDecoderReader.cpp +++ b/dom/media/MediaDecoderReader.cpp @@ -22,7 +22,7 @@ namespace mozilla { // Un-comment to enable logging of seek bisections. //#define SEEK_LOGGING -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define DECODER_LOG(x, ...) \ MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("Decoder=%p " x, mDecoder, ##__VA_ARGS__)) diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index fa994d26410d..f8977bc3016f 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -107,8 +107,8 @@ class AudioSegment; class DecodedStream; class TaskQueue; -extern PRLogModuleInfo* gMediaDecoderLog; -extern PRLogModuleInfo* gMediaSampleLog; +extern LazyLogModule gMediaDecoderLog; +extern LazyLogModule gMediaSampleLog; /* The state machine class. This manages the decoding and seeking in the diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 29c9fcf4be2d..2ac3e151f40e 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -28,15 +28,10 @@ using mozilla::layers::Image; using mozilla::layers::LayerManager; using mozilla::layers::LayersBackend; -PRLogModuleInfo* GetFormatDecoderLog() { - static PRLogModuleInfo* log = nullptr; - if (!log) { - log = PR_NewLogModule("MediaFormatReader"); - } - return log; -} -#define LOG(arg, ...) MOZ_LOG(GetFormatDecoderLog(), mozilla::LogLevel::Debug, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) -#define LOGV(arg, ...) MOZ_LOG(GetFormatDecoderLog(), mozilla::LogLevel::Verbose, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +static mozilla::LazyLogModule sFormatDecoderLog("MediaFormatReader"); + +#define LOG(arg, ...) MOZ_LOG(sFormatDecoderLog, mozilla::LogLevel::Debug, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define LOGV(arg, ...) MOZ_LOG(sFormatDecoderLog, mozilla::LogLevel::Verbose, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 00a88dae1971..15f639838c57 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -104,12 +104,10 @@ namespace mozilla { #undef LOG #endif -PRLogModuleInfo* +LogModule* GetMediaManagerLog() { - static PRLogModuleInfo *sLog; - if (!sLog) - sLog = PR_NewLogModule("MediaManager"); + static LazyLogModule sLog("MediaManager"); return sLog; } #define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h index 0454f7a769af..45223fe779b9 100644 --- a/dom/media/MediaManager.h +++ b/dom/media/MediaManager.h @@ -51,7 +51,7 @@ struct MediaTrackConstraints; struct MediaTrackConstraintSet; } // namespace dom -extern PRLogModuleInfo* GetMediaManagerLog(); +extern LogModule* GetMediaManagerLog(); #define MM_LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) class MediaDevice : public nsIMediaDevice diff --git a/dom/media/MediaRecorder.cpp b/dom/media/MediaRecorder.cpp index 68d03d8aebb1..9bfbf0d3fee2 100644 --- a/dom/media/MediaRecorder.cpp +++ b/dom/media/MediaRecorder.cpp @@ -31,7 +31,7 @@ #undef LOG #endif -PRLogModuleInfo* gMediaRecorderLog; +mozilla::LazyLogModule gMediaRecorderLog("MediaRecorder"); #define LOG(type, msg) MOZ_LOG(gMediaRecorderLog, type, msg) namespace mozilla { @@ -776,9 +776,7 @@ MediaRecorder::MediaRecorder(DOMMediaStream& aSourceMediaStream, MOZ_ASSERT(aOwnerWindow); MOZ_ASSERT(aOwnerWindow->IsInnerWindow()); mDOMStream = &aSourceMediaStream; - if (!gMediaRecorderLog) { - gMediaRecorderLog = PR_NewLogModule("MediaRecorder"); - } + RegisterActivityObserver(); } @@ -809,9 +807,7 @@ MediaRecorder::MediaRecorder(AudioNode& aSrcAudioNode, } } mAudioNode = &aSrcAudioNode; - if (!gMediaRecorderLog) { - gMediaRecorderLog = PR_NewLogModule("MediaRecorder"); - } + RegisterActivityObserver(); } diff --git a/dom/media/MediaResource.cpp b/dom/media/MediaResource.cpp index 22f83f02273a..f0dfb9563fc7 100644 --- a/dom/media/MediaResource.cpp +++ b/dom/media/MediaResource.cpp @@ -36,7 +36,7 @@ using mozilla::media::TimeUnit; -PRLogModuleInfo* gMediaResourceLog; +mozilla::LazyLogModule gMediaResourceLog("MediaResource"); #define RESOURCE_LOG(msg, ...) MOZ_LOG(gMediaResourceLog, mozilla::LogLevel::Debug, \ (msg, ##__VA_ARGS__)) // Debug logging macro with object pointer and class name. @@ -79,9 +79,6 @@ ChannelMediaResource::ChannelMediaResource(MediaResourceCallback* aCallback, mIsTransportSeekable(true), mSuspendAgent(mChannel) { - if (!gMediaResourceLog) { - gMediaResourceLog = PR_NewLogModule("MediaResource"); - } } ChannelMediaResource::~ChannelMediaResource() diff --git a/dom/media/MediaShutdownManager.cpp b/dom/media/MediaShutdownManager.cpp index 46952f2227ee..b55954b66440 100644 --- a/dom/media/MediaShutdownManager.cpp +++ b/dom/media/MediaShutdownManager.cpp @@ -12,7 +12,7 @@ namespace mozilla { -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define DECODER_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) NS_IMPL_ISUPPORTS(MediaShutdownManager, nsIObserver) diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index 626a6d915e76..6c5f8992f624 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -39,7 +39,7 @@ using namespace mozilla::gfx; namespace mozilla { -PRLogModuleInfo* gMediaStreamGraphLog; +LazyLogModule gMediaStreamGraphLog("MediaStreamGraph"); #define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg) // #define ENABLE_LIFECYCLE_LOG @@ -2639,10 +2639,6 @@ MediaStreamGraphImpl::MediaStreamGraphImpl(GraphDriverType aDriverRequested, #endif , mAudioChannel(aChannel) { - if (!gMediaStreamGraphLog) { - gMediaStreamGraphLog = PR_NewLogModule("MediaStreamGraph"); - } - if (mRealtime) { if (aDriverRequested == AUDIO_THREAD_DRIVER) { AudioCallbackDriver* driver = new AudioCallbackDriver(this); diff --git a/dom/media/MediaStreamGraph.h b/dom/media/MediaStreamGraph.h index 05eb8b46c666..724ff0c24ba3 100644 --- a/dom/media/MediaStreamGraph.h +++ b/dom/media/MediaStreamGraph.h @@ -35,7 +35,7 @@ class nsAutoRefTraits : public nsPointerRefTraitsAsyncOpen(mListener); - if (!gRtspMediaResourceLog) { - gRtspMediaResourceLog = PR_NewLogModule("RtspMediaResource"); - } #endif } diff --git a/dom/media/StreamBuffer.cpp b/dom/media/StreamBuffer.cpp index 5af63e5b01c3..516982ca701b 100644 --- a/dom/media/StreamBuffer.cpp +++ b/dom/media/StreamBuffer.cpp @@ -9,7 +9,7 @@ namespace mozilla { -extern PRLogModuleInfo* gMediaStreamGraphLog; +extern LazyLogModule gMediaStreamGraphLog; #define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg) #ifdef DEBUG diff --git a/dom/media/TrackUnionStream.cpp b/dom/media/TrackUnionStream.cpp index e4e844a4380c..9325641970a3 100644 --- a/dom/media/TrackUnionStream.cpp +++ b/dom/media/TrackUnionStream.cpp @@ -42,15 +42,12 @@ namespace mozilla { #undef STREAM_LOG #endif -PRLogModuleInfo* gTrackUnionStreamLog; +LazyLogModule gTrackUnionStreamLog("TrackUnionStream"); #define STREAM_LOG(type, msg) MOZ_LOG(gTrackUnionStreamLog, type, msg) TrackUnionStream::TrackUnionStream(DOMMediaStream* aWrapper) : ProcessedMediaStream(aWrapper), mNextAvailableTrackID(1) { - if (!gTrackUnionStreamLog) { - gTrackUnionStreamLog = PR_NewLogModule("TrackUnionStream"); - } } void TrackUnionStream::RemoveInput(MediaInputPort* aPort) diff --git a/dom/media/WebVTTListener.cpp b/dom/media/WebVTTListener.cpp index 5727e8c71879..a93217ad5ed3 100644 --- a/dom/media/WebVTTListener.cpp +++ b/dom/media/WebVTTListener.cpp @@ -28,16 +28,13 @@ NS_INTERFACE_MAP_END NS_IMPL_CYCLE_COLLECTING_ADDREF(WebVTTListener) NS_IMPL_CYCLE_COLLECTING_RELEASE(WebVTTListener) -PRLogModuleInfo* gTextTrackLog; +LazyLogModule gTextTrackLog("TextTrack"); # define VTT_LOG(...) MOZ_LOG(gTextTrackLog, LogLevel::Debug, (__VA_ARGS__)) WebVTTListener::WebVTTListener(HTMLTrackElement* aElement) : mElement(aElement) { MOZ_ASSERT(mElement, "Must pass an element to the callback"); - if (!gTextTrackLog) { - gTextTrackLog = PR_NewLogModule("TextTrack"); - } VTT_LOG("WebVTTListener created."); } diff --git a/dom/media/apple/AppleMP3Reader.cpp b/dom/media/apple/AppleMP3Reader.cpp index 68a6318c2802..18bfe15a0fe5 100644 --- a/dom/media/apple/AppleMP3Reader.cpp +++ b/dom/media/apple/AppleMP3Reader.cpp @@ -23,7 +23,7 @@ using namespace mozilla::media; namespace mozilla { -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define LOGE(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Error, (__VA_ARGS__)) #define LOGW(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Warning, (__VA_ARGS__)) #define LOGD(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) diff --git a/dom/media/directshow/AudioSinkFilter.cpp b/dom/media/directshow/AudioSinkFilter.cpp index 3d2b93b46bc8..5682af1a5876 100644 --- a/dom/media/directshow/AudioSinkFilter.cpp +++ b/dom/media/directshow/AudioSinkFilter.cpp @@ -23,7 +23,7 @@ using namespace mozilla::media; namespace mozilla { -PRLogModuleInfo* GetDirectShowLog(); +extern LogModule* GetDirectShowLog(); #define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) AudioSinkFilter::AudioSinkFilter(const wchar_t* aObjectName, HRESULT* aOutResult) diff --git a/dom/media/directshow/AudioSinkInputPin.cpp b/dom/media/directshow/AudioSinkInputPin.cpp index d3187c58f2a9..285dc3ca8736 100644 --- a/dom/media/directshow/AudioSinkInputPin.cpp +++ b/dom/media/directshow/AudioSinkInputPin.cpp @@ -15,7 +15,7 @@ using namespace mozilla::media; namespace mozilla { -PRLogModuleInfo* GetDirectShowLog(); +extern LogModule* GetDirectShowLog(); #define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) AudioSinkInputPin::AudioSinkInputPin(wchar_t* aObjectName, diff --git a/dom/media/directshow/DirectShowReader.cpp b/dom/media/directshow/DirectShowReader.cpp index b2a52850bdf5..ed6390a79e5c 100644 --- a/dom/media/directshow/DirectShowReader.cpp +++ b/dom/media/directshow/DirectShowReader.cpp @@ -18,13 +18,9 @@ using namespace mozilla::media; namespace mozilla { - -PRLogModuleInfo* +LogModule* GetDirectShowLog() { - static PRLogModuleInfo* log = nullptr; - if (!log) { - log = PR_NewLogModule("DirectShowDecoder"); - } + static LazyLogModule log("DirectShowDecoder"); return log; } diff --git a/dom/media/directshow/SampleSink.cpp b/dom/media/directshow/SampleSink.cpp index 54b62508d265..1102d32f5a38 100644 --- a/dom/media/directshow/SampleSink.cpp +++ b/dom/media/directshow/SampleSink.cpp @@ -14,7 +14,7 @@ using namespace mozilla::media; namespace mozilla { -PRLogModuleInfo* GetDirectShowLog(); +extern LogModule* GetDirectShowLog(); #define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) SampleSink::SampleSink() diff --git a/dom/media/directshow/SourceFilter.cpp b/dom/media/directshow/SourceFilter.cpp index 3eb11ea4b8b5..e563b49cf608 100644 --- a/dom/media/directshow/SourceFilter.cpp +++ b/dom/media/directshow/SourceFilter.cpp @@ -20,7 +20,7 @@ namespace mozilla { //#define DEBUG_SOURCE_TRACE 1 #if defined (DEBUG_SOURCE_TRACE) -PRLogModuleInfo* GetDirectShowLog(); +extern LogModule* GetDirectShowLog(); #define DIRECTSHOW_LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #else #define DIRECTSHOW_LOG(...) diff --git a/dom/media/eme/EMEUtils.cpp b/dom/media/eme/EMEUtils.cpp index 5d0af6f71791..b89879a6f8ec 100644 --- a/dom/media/eme/EMEUtils.cpp +++ b/dom/media/eme/EMEUtils.cpp @@ -8,19 +8,13 @@ namespace mozilla { -PRLogModuleInfo* GetEMELog() { - static PRLogModuleInfo* log = nullptr; - if (!log) { - log = PR_NewLogModule("EME"); - } +LogModule* GetEMELog() { + static LazyLogModule log("EME"); return log; } -PRLogModuleInfo* GetEMEVerboseLog() { - static PRLogModuleInfo* log = nullptr; - if (!log) { - log = PR_NewLogModule("EMEV"); - } +LogModule* GetEMEVerboseLog() { + static LazyLogModule log("EMEV"); return log; } diff --git a/dom/media/eme/EMEUtils.h b/dom/media/eme/EMEUtils.h index a8fde65f8532..6768213b5d90 100644 --- a/dom/media/eme/EMEUtils.h +++ b/dom/media/eme/EMEUtils.h @@ -13,13 +13,13 @@ namespace mozilla { #ifndef EME_LOG - PRLogModuleInfo* GetEMELog(); + LogModule* GetEMELog(); #define EME_LOG(...) MOZ_LOG(GetEMELog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #define EME_LOG_ENABLED() MOZ_LOG_TEST(GetEMELog(), mozilla::LogLevel::Debug) #endif #ifndef EME_VERBOSE_LOG - PRLogModuleInfo* GetEMEVerboseLog(); + LogModule* GetEMEVerboseLog(); #define EME_VERBOSE_LOG(...) MOZ_LOG(GetEMEVerboseLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #else #ifndef EME_LOG diff --git a/dom/media/encoder/MediaEncoder.cpp b/dom/media/encoder/MediaEncoder.cpp index 4a7b26ba7df5..2d37598c40f8 100644 --- a/dom/media/encoder/MediaEncoder.cpp +++ b/dom/media/encoder/MediaEncoder.cpp @@ -31,7 +31,7 @@ #undef LOG #endif -PRLogModuleInfo* gMediaEncoderLog; +mozilla::LazyLogModule gMediaEncoderLog("MediaEncoder"); #define LOG(type, msg) MOZ_LOG(gMediaEncoderLog, type, msg) namespace mozilla { @@ -79,9 +79,6 @@ MediaEncoder::CreateEncoder(const nsAString& aMIMEType, uint32_t aAudioBitrate, uint32_t aVideoBitrate, uint32_t aBitrate, uint8_t aTrackTypes) { - if (!gMediaEncoderLog) { - gMediaEncoderLog = PR_NewLogModule("MediaEncoder"); - } PROFILER_LABEL("MediaEncoder", "CreateEncoder", js::ProfileEntry::Category::OTHER); diff --git a/dom/media/encoder/TrackEncoder.cpp b/dom/media/encoder/TrackEncoder.cpp index c617980a1401..7e2161a0c590 100644 --- a/dom/media/encoder/TrackEncoder.cpp +++ b/dom/media/encoder/TrackEncoder.cpp @@ -18,7 +18,7 @@ namespace mozilla { -PRLogModuleInfo* gTrackEncoderLog; +LazyLogModule gTrackEncoderLog("TrackEncoder"); #define TRACK_LOG(type, msg) MOZ_LOG(gTrackEncoderLog, type, msg) static const int DEFAULT_CHANNELS = 1; @@ -37,9 +37,6 @@ TrackEncoder::TrackEncoder() , mAudioInitCounter(0) , mVideoInitCounter(0) { - if (!gTrackEncoderLog) { - gTrackEncoderLog = PR_NewLogModule("TrackEncoder"); - } } void diff --git a/dom/media/encoder/VP8TrackEncoder.cpp b/dom/media/encoder/VP8TrackEncoder.cpp index f318cc9ca475..48a33a4d19a4 100644 --- a/dom/media/encoder/VP8TrackEncoder.cpp +++ b/dom/media/encoder/VP8TrackEncoder.cpp @@ -17,7 +17,7 @@ namespace mozilla { -PRLogModuleInfo* gVP8TrackEncoderLog; +LazyLogModule gVP8TrackEncoderLog("VP8TrackEncoder"); #define VP8LOG(msg, ...) MOZ_LOG(gVP8TrackEncoderLog, mozilla::LogLevel::Debug, \ (msg, ##__VA_ARGS__)) // Debug logging macro with object pointer and class name. @@ -37,9 +37,6 @@ VP8TrackEncoder::VP8TrackEncoder() , mVPXImageWrapper(new vpx_image_t()) { MOZ_COUNT_CTOR(VP8TrackEncoder); - if (!gVP8TrackEncoderLog) { - gVP8TrackEncoderLog = PR_NewLogModule("VP8TrackEncoder"); - } } VP8TrackEncoder::~VP8TrackEncoder() diff --git a/dom/media/encoder/VorbisTrackEncoder.cpp b/dom/media/encoder/VorbisTrackEncoder.cpp index c22b3e05600d..3a1c153bd513 100644 --- a/dom/media/encoder/VorbisTrackEncoder.cpp +++ b/dom/media/encoder/VorbisTrackEncoder.cpp @@ -17,7 +17,7 @@ static const float BASE_QUALITY = 0.4f; namespace mozilla { #undef LOG -PRLogModuleInfo* gVorbisTrackEncoderLog; +LazyLogModule gVorbisTrackEncoderLog("VorbisTrackEncoder"); #define VORBISLOG(msg, ...) MOZ_LOG(gVorbisTrackEncoderLog, mozilla::LogLevel::Debug, \ (msg, ##__VA_ARGS__)) @@ -25,9 +25,6 @@ VorbisTrackEncoder::VorbisTrackEncoder() : AudioTrackEncoder() { MOZ_COUNT_CTOR(VorbisTrackEncoder); - if (!gVorbisTrackEncoderLog) { - gVorbisTrackEncoderLog = PR_NewLogModule("VorbisTrackEncoder"); - } } VorbisTrackEncoder::~VorbisTrackEncoder() diff --git a/dom/media/fmp4/MP4Demuxer.cpp b/dom/media/fmp4/MP4Demuxer.cpp index d281594181af..6c11eca7bbb1 100644 --- a/dom/media/fmp4/MP4Demuxer.cpp +++ b/dom/media/fmp4/MP4Demuxer.cpp @@ -20,11 +20,8 @@ #include "mp4_demuxer/AnnexB.h" #include "mp4_demuxer/H264.h" -PRLogModuleInfo* GetDemuxerLog() { - static PRLogModuleInfo* log = nullptr; - if (!log) { - log = PR_NewLogModule("MP4Demuxer"); - } +mozilla::LogModule* GetDemuxerLog() { + static mozilla::LazyLogModule log("MP4Demuxer"); return log; } diff --git a/dom/media/gmp/GMPAudioDecoderParent.cpp b/dom/media/gmp/GMPAudioDecoderParent.cpp index b9a8cba8d5df..b73c0d973f14 100644 --- a/dom/media/gmp/GMPAudioDecoderParent.cpp +++ b/dom/media/gmp/GMPAudioDecoderParent.cpp @@ -17,7 +17,7 @@ namespace mozilla { #undef LOG #endif -extern PRLogModuleInfo* GetGMPLog(); +extern LogModule* GetGMPLog(); #define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg) #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp index 8d0279ecea53..95ee0eb74763 100644 --- a/dom/media/gmp/GMPChild.cpp +++ b/dom/media/gmp/GMPChild.cpp @@ -43,7 +43,7 @@ namespace mozilla { #undef LOG #undef LOGD -extern PRLogModuleInfo* GetGMPLog(); +extern LogModule* GetGMPLog(); #define LOG(level, x, ...) MOZ_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__)) #define LOGD(x, ...) LOG(mozilla::LogLevel::Debug, "GMPChild[pid=%d] " x, (int)base::GetCurrentProcId(), ##__VA_ARGS__) diff --git a/dom/media/gmp/GMPContentParent.cpp b/dom/media/gmp/GMPContentParent.cpp index b238445f8965..4b89dc7c532d 100644 --- a/dom/media/gmp/GMPContentParent.cpp +++ b/dom/media/gmp/GMPContentParent.cpp @@ -20,7 +20,7 @@ namespace mozilla { #undef LOG #endif -extern PRLogModuleInfo* GetGMPLog(); +extern LogModule* GetGMPLog(); #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) diff --git a/dom/media/gmp/GMPDecryptorParent.cpp b/dom/media/gmp/GMPDecryptorParent.cpp index 375b46aad003..60d206ee678e 100644 --- a/dom/media/gmp/GMPDecryptorParent.cpp +++ b/dom/media/gmp/GMPDecryptorParent.cpp @@ -14,7 +14,7 @@ namespace mozilla { #undef LOG #endif -extern PRLogModuleInfo* GetGMPLog(); +extern LogModule* GetGMPLog(); #define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg) #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index 1593f0e28545..28e9671fd9f2 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -43,7 +43,7 @@ namespace mozilla { #undef LOG #undef LOGD -extern PRLogModuleInfo* GetGMPLog(); +extern LogModule* GetGMPLog(); #define LOG(level, x, ...) MOZ_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__)) #define LOGD(x, ...) LOG(mozilla::LogLevel::Debug, "GMPParent[%p|childPid=%d] " x, this, mChildPid, ##__VA_ARGS__) diff --git a/dom/media/gmp/GMPService.cpp b/dom/media/gmp/GMPService.cpp index 8c5b151eb165..03dac0fdb813 100644 --- a/dom/media/gmp/GMPService.cpp +++ b/dom/media/gmp/GMPService.cpp @@ -46,12 +46,10 @@ namespace mozilla { #undef LOG #endif -PRLogModuleInfo* +LogModule* GetGMPLog() { - static PRLogModuleInfo *sLog; - if (!sLog) - sLog = PR_NewLogModule("GMP"); + static LazyLogModule sLog("GMP"); return sLog; } diff --git a/dom/media/gmp/GMPService.h b/dom/media/gmp/GMPService.h index 313fd1daf998..0dac2d8a75e1 100644 --- a/dom/media/gmp/GMPService.h +++ b/dom/media/gmp/GMPService.h @@ -24,7 +24,7 @@ template struct already_AddRefed; namespace mozilla { -extern PRLogModuleInfo* GetGMPLog(); +extern LogModule* GetGMPLog(); namespace gmp { diff --git a/dom/media/gmp/GMPStorageParent.cpp b/dom/media/gmp/GMPStorageParent.cpp index 2ec2210772d9..c048f876950b 100644 --- a/dom/media/gmp/GMPStorageParent.cpp +++ b/dom/media/gmp/GMPStorageParent.cpp @@ -25,7 +25,7 @@ namespace mozilla { #undef LOG #endif -extern PRLogModuleInfo* GetGMPLog(); +extern LogModule* GetGMPLog(); #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) diff --git a/dom/media/gmp/GMPTimerParent.cpp b/dom/media/gmp/GMPTimerParent.cpp index 8e584904810c..260433d01583 100644 --- a/dom/media/gmp/GMPTimerParent.cpp +++ b/dom/media/gmp/GMPTimerParent.cpp @@ -13,7 +13,7 @@ namespace mozilla { #undef LOG #endif -extern PRLogModuleInfo* GetGMPLog(); +extern LogModule* GetGMPLog(); #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) diff --git a/dom/media/gmp/GMPVideoDecoderParent.cpp b/dom/media/gmp/GMPVideoDecoderParent.cpp index 6535b0d47977..d983df4d9b0a 100644 --- a/dom/media/gmp/GMPVideoDecoderParent.cpp +++ b/dom/media/gmp/GMPVideoDecoderParent.cpp @@ -21,7 +21,7 @@ namespace mozilla { #undef LOG #endif -extern PRLogModuleInfo* GetGMPLog(); +extern LogModule* GetGMPLog(); #define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg) #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) diff --git a/dom/media/gmp/GMPVideoEncoderParent.cpp b/dom/media/gmp/GMPVideoEncoderParent.cpp index 311ecef99ca3..b142e7fabfee 100644 --- a/dom/media/gmp/GMPVideoEncoderParent.cpp +++ b/dom/media/gmp/GMPVideoEncoderParent.cpp @@ -23,7 +23,7 @@ namespace mozilla { #undef LOG #endif -extern PRLogModuleInfo* GetGMPLog(); +extern LogModule* GetGMPLog(); #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) diff --git a/dom/media/gstreamer/GStreamerFormatHelper.cpp b/dom/media/gstreamer/GStreamerFormatHelper.cpp index d7649b806a1c..fd545ac7ea96 100644 --- a/dom/media/gstreamer/GStreamerFormatHelper.cpp +++ b/dom/media/gstreamer/GStreamerFormatHelper.cpp @@ -16,7 +16,7 @@ namespace mozilla { -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define LOG(msg, ...) \ MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("GStreamerFormatHelper " msg, ##__VA_ARGS__)) diff --git a/dom/media/gstreamer/GStreamerReader.cpp b/dom/media/gstreamer/GStreamerReader.cpp index 58bd4dcaa3d6..aff07e085819 100644 --- a/dom/media/gstreamer/GStreamerReader.cpp +++ b/dom/media/gstreamer/GStreamerReader.cpp @@ -29,7 +29,7 @@ using namespace media; // Un-comment to enable logging of seek bisections. //#define SEEK_LOGGING -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define LOG(type, msg, ...) \ MOZ_LOG(gMediaDecoderLog, type, ("GStreamerReader(%p) " msg, this, ##__VA_ARGS__)) diff --git a/dom/media/imagecapture/ImageCapture.cpp b/dom/media/imagecapture/ImageCapture.cpp index f01664721177..a169d9c3807e 100644 --- a/dom/media/imagecapture/ImageCapture.cpp +++ b/dom/media/imagecapture/ImageCapture.cpp @@ -18,12 +18,9 @@ namespace mozilla { -PRLogModuleInfo* GetICLog() +LogModule* GetICLog() { - static PRLogModuleInfo* log = nullptr; - if (!log) { - log = PR_NewLogModule("ImageCapture"); - } + static LazyLogModule log("ImageCapture"); return log; } diff --git a/dom/media/imagecapture/ImageCapture.h b/dom/media/imagecapture/ImageCapture.h index 7a47af45e721..fc8f5385acb6 100644 --- a/dom/media/imagecapture/ImageCapture.h +++ b/dom/media/imagecapture/ImageCapture.h @@ -14,7 +14,7 @@ namespace mozilla { #ifndef IC_LOG -PRLogModuleInfo* GetICLog(); +LogModule* GetICLog(); #define IC_LOG(...) MOZ_LOG(GetICLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #endif diff --git a/dom/media/mediasink/DecodedAudioDataSink.cpp b/dom/media/mediasink/DecodedAudioDataSink.cpp index 5d0c89e2381b..8a8eaaf6221d 100644 --- a/dom/media/mediasink/DecodedAudioDataSink.cpp +++ b/dom/media/mediasink/DecodedAudioDataSink.cpp @@ -14,7 +14,7 @@ namespace mozilla { -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define SINK_LOG(msg, ...) \ MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, \ ("DecodedAudioDataSink=%p " msg, this, ##__VA_ARGS__)) diff --git a/dom/media/mediasink/VideoSink.cpp b/dom/media/mediasink/VideoSink.cpp index c5275a042699..df675de0caf4 100644 --- a/dom/media/mediasink/VideoSink.cpp +++ b/dom/media/mediasink/VideoSink.cpp @@ -8,7 +8,7 @@ namespace mozilla { -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define VSINK_LOG(msg, ...) \ MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, \ ("VideoSink=%p " msg, this, ##__VA_ARGS__)) diff --git a/dom/media/mediasource/ContainerParser.cpp b/dom/media/mediasource/ContainerParser.cpp index f2be166346c9..349723ef0457 100644 --- a/dom/media/mediasource/ContainerParser.cpp +++ b/dom/media/mediasource/ContainerParser.cpp @@ -20,7 +20,7 @@ #endif #include "SourceBufferResource.h" -extern PRLogModuleInfo* GetMediaSourceSamplesLog(); +extern mozilla::LogModule* GetMediaSourceSamplesLog(); #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) diff --git a/dom/media/mediasource/MediaSource.cpp b/dom/media/mediasource/MediaSource.cpp index ac3ebe99d19e..b0de675f68e4 100644 --- a/dom/media/mediasource/MediaSource.cpp +++ b/dom/media/mediasource/MediaSource.cpp @@ -36,21 +36,15 @@ struct JSContext; class JSObject; -PRLogModuleInfo* GetMediaSourceLog() +mozilla::LogModule* GetMediaSourceLog() { - static PRLogModuleInfo* sLogModule = nullptr; - if (!sLogModule) { - sLogModule = PR_NewLogModule("MediaSource"); - } + static mozilla::LazyLogModule sLogModule("MediaSource"); return sLogModule; } -PRLogModuleInfo* GetMediaSourceAPILog() +mozilla::LogModule* GetMediaSourceAPILog() { - static PRLogModuleInfo* sLogModule = nullptr; - if (!sLogModule) { - sLogModule = PR_NewLogModule("MediaSource"); - } + static mozilla::LazyLogModule sLogModule("MediaSource"); return sLogModule; } diff --git a/dom/media/mediasource/MediaSourceDecoder.cpp b/dom/media/mediasource/MediaSourceDecoder.cpp index 1859f330cdce..395b82739bd5 100644 --- a/dom/media/mediasource/MediaSourceDecoder.cpp +++ b/dom/media/mediasource/MediaSourceDecoder.cpp @@ -17,7 +17,7 @@ #include "MediaSourceDemuxer.h" #include "SourceBufferList.h" -extern PRLogModuleInfo* GetMediaSourceLog(); +extern mozilla::LogModule* GetMediaSourceLog(); #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) #define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) diff --git a/dom/media/mediasource/MediaSourceResource.h b/dom/media/mediasource/MediaSourceResource.h index 38b2c347fb20..467232117d08 100644 --- a/dom/media/mediasource/MediaSourceResource.h +++ b/dom/media/mediasource/MediaSourceResource.h @@ -11,7 +11,7 @@ #include "mozilla/Monitor.h" #include "mozilla/Logging.h" -extern PRLogModuleInfo* GetMediaSourceLog(); +extern mozilla::LogModule* GetMediaSourceLog(); #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSourceResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) diff --git a/dom/media/mediasource/ResourceQueue.cpp b/dom/media/mediasource/ResourceQueue.cpp index 019764062908..58cc0a2fb582 100644 --- a/dom/media/mediasource/ResourceQueue.cpp +++ b/dom/media/mediasource/ResourceQueue.cpp @@ -10,7 +10,7 @@ #include "mozilla/ErrorResult.h" #include "mozilla/Logging.h" -extern PRLogModuleInfo* GetSourceBufferResourceLog(); +extern mozilla::LogModule* GetSourceBufferResourceLog(); #define SBR_DEBUG(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), mozilla::LogLevel::Debug, ("ResourceQueue(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) #define SBR_DEBUGV(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), mozilla::LogLevel::Verbose, ("ResourceQueue(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) diff --git a/dom/media/mediasource/SourceBuffer.cpp b/dom/media/mediasource/SourceBuffer.cpp index b76d0b29c67f..a4e8fc2fa509 100644 --- a/dom/media/mediasource/SourceBuffer.cpp +++ b/dom/media/mediasource/SourceBuffer.cpp @@ -26,8 +26,8 @@ struct JSContext; class JSObject; -extern PRLogModuleInfo* GetMediaSourceLog(); -extern PRLogModuleInfo* GetMediaSourceAPILog(); +extern mozilla::LogModule* GetMediaSourceLog(); +extern mozilla::LogModule* GetMediaSourceAPILog(); #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) #define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) diff --git a/dom/media/mediasource/SourceBufferList.cpp b/dom/media/mediasource/SourceBufferList.cpp index 5984bc534874..bea935f3d1e6 100644 --- a/dom/media/mediasource/SourceBufferList.cpp +++ b/dom/media/mediasource/SourceBufferList.cpp @@ -16,8 +16,8 @@ #include "nsThreadUtils.h" #include "mozilla/Logging.h" -extern PRLogModuleInfo* GetMediaSourceLog(); -extern PRLogModuleInfo* GetMediaSourceAPILog(); +extern mozilla::LogModule* GetMediaSourceLog(); +extern mozilla::LogModule* GetMediaSourceAPILog(); #define MSE_API(arg, ...) MOZ_LOG(GetMediaSourceAPILog(), mozilla::LogLevel::Debug, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) diff --git a/dom/media/mediasource/SourceBufferResource.cpp b/dom/media/mediasource/SourceBufferResource.cpp index 9611a60f272b..32c4230e66b0 100644 --- a/dom/media/mediasource/SourceBufferResource.cpp +++ b/dom/media/mediasource/SourceBufferResource.cpp @@ -13,12 +13,9 @@ #include "mozilla/Logging.h" #include "MediaData.h" -PRLogModuleInfo* GetSourceBufferResourceLog() +mozilla::LogModule* GetSourceBufferResourceLog() { - static PRLogModuleInfo* sLogModule = nullptr; - if (!sLogModule) { - sLogModule = PR_NewLogModule("SourceBufferResource"); - } + static mozilla::LazyLogModule sLogModule("SourceBufferResource"); return sLogModule; } diff --git a/dom/media/mediasource/TrackBuffersManager.cpp b/dom/media/mediasource/TrackBuffersManager.cpp index c2b97634b5eb..21a3f078dad5 100644 --- a/dom/media/mediasource/TrackBuffersManager.cpp +++ b/dom/media/mediasource/TrackBuffersManager.cpp @@ -23,17 +23,14 @@ #include -extern PRLogModuleInfo* GetMediaSourceLog(); +extern mozilla::LogModule* GetMediaSourceLog(); #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("TrackBuffersManager(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) #define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("TrackBuffersManager(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) -PRLogModuleInfo* GetMediaSourceSamplesLog() +mozilla::LogModule* GetMediaSourceSamplesLog() { - static PRLogModuleInfo* sLogModule = nullptr; - if (!sLogModule) { - sLogModule = PR_NewLogModule("MediaSourceSamples"); - } + static mozilla::LazyLogModule sLogModule("MediaSourceSamples"); return sLogModule; } #define SAMPLE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceSamplesLog(), mozilla::LogLevel::Debug, ("TrackBuffersManager(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) diff --git a/dom/media/ogg/OggCodecState.cpp b/dom/media/ogg/OggCodecState.cpp index e0761d0fb774..8184053ec710 100644 --- a/dom/media/ogg/OggCodecState.cpp +++ b/dom/media/ogg/OggCodecState.cpp @@ -32,7 +32,7 @@ namespace mozilla { -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) /** Decoder base class for Ogg-encapsulated streams. */ diff --git a/dom/media/ogg/OggReader.cpp b/dom/media/ogg/OggReader.cpp index 91d4a2789831..c97d1928e1f0 100644 --- a/dom/media/ogg/OggReader.cpp +++ b/dom/media/ogg/OggReader.cpp @@ -37,7 +37,7 @@ namespace mozilla { // Un-comment to enable logging of seek bisections. //#define SEEK_LOGGING -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) #ifdef SEEK_LOGGING #define SEEK_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) diff --git a/dom/media/ogg/OpusParser.cpp b/dom/media/ogg/OpusParser.cpp index 8bdaf7f55017..c450df9a22a6 100644 --- a/dom/media/ogg/OpusParser.cpp +++ b/dom/media/ogg/OpusParser.cpp @@ -24,7 +24,7 @@ extern "C" { namespace mozilla { -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define OPUS_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) OpusParser::OpusParser(): diff --git a/dom/media/omx/AudioOffloadPlayer.cpp b/dom/media/omx/AudioOffloadPlayer.cpp index 61dd15d003be..cb8a7df9c040 100644 --- a/dom/media/omx/AudioOffloadPlayer.cpp +++ b/dom/media/omx/AudioOffloadPlayer.cpp @@ -42,7 +42,7 @@ using namespace android; namespace mozilla { -PRLogModuleInfo* gAudioOffloadPlayerLog; +LazyLogModule gAudioOffloadPlayerLog("AudioOffloadPlayer"); #define AUDIO_OFFLOAD_LOG(type, msg) \ MOZ_LOG(gAudioOffloadPlayerLog, type, msg) @@ -63,10 +63,6 @@ AudioOffloadPlayer::AudioOffloadPlayer(MediaOmxCommonDecoder* aObserver) : { MOZ_ASSERT(NS_IsMainThread()); - if (!gAudioOffloadPlayerLog) { - gAudioOffloadPlayerLog = PR_NewLogModule("AudioOffloadPlayer"); - } - CHECK(aObserver); #if ANDROID_VERSION >= 21 mSessionId = AudioSystem::newAudioUniqueId(); diff --git a/dom/media/omx/AudioOutput.cpp b/dom/media/omx/AudioOutput.cpp index 9754da32b3d0..132d09d77c2d 100644 --- a/dom/media/omx/AudioOutput.cpp +++ b/dom/media/omx/AudioOutput.cpp @@ -24,7 +24,7 @@ namespace mozilla { -extern PRLogModuleInfo* gAudioOffloadPlayerLog; +extern LazyLogModule gAudioOffloadPlayerLog; #define AUDIO_OFFLOAD_LOG(type, msg) \ MOZ_LOG(gAudioOffloadPlayerLog, type, msg) @@ -37,9 +37,6 @@ AudioOutput::AudioOutput(int aSessionId, int aUid) : mUid(aUid), mSessionId(aSessionId) { - if (!gAudioOffloadPlayerLog) { - gAudioOffloadPlayerLog = PR_NewLogModule("AudioOffloadPlayer"); - } } AudioOutput::~AudioOutput() diff --git a/dom/media/omx/I420ColorConverterHelper.cpp b/dom/media/omx/I420ColorConverterHelper.cpp index 8afcbc4cb073..f1e248499d2a 100644 --- a/dom/media/omx/I420ColorConverterHelper.cpp +++ b/dom/media/omx/I420ColorConverterHelper.cpp @@ -10,7 +10,7 @@ #include "mozilla/Logging.h" -PRLogModuleInfo *gI420ColorConverterHelperLog; +mozilla::LazyLogModule gI420ColorConverterHelperLog("I420ColorConverterHelper"); #define LOG(msg...) MOZ_LOG(gI420ColorConverterHelperLog, mozilla::LogLevel::Warning, (msg)) namespace android { @@ -19,9 +19,6 @@ I420ColorConverterHelper::I420ColorConverterHelper() : mHandle(nullptr) , mConverter({nullptr, nullptr, nullptr, nullptr, nullptr}) { - if (!gI420ColorConverterHelperLog) { - gI420ColorConverterHelperLog = PR_NewLogModule("I420ColorConverterHelper"); - } } I420ColorConverterHelper::~I420ColorConverterHelper() diff --git a/dom/media/omx/MediaOmxCommonDecoder.cpp b/dom/media/omx/MediaOmxCommonDecoder.cpp index 638e9e69d4fd..73ab320d3835 100644 --- a/dom/media/omx/MediaOmxCommonDecoder.cpp +++ b/dom/media/omx/MediaOmxCommonDecoder.cpp @@ -20,7 +20,7 @@ using namespace android; namespace mozilla { -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define DECODER_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) MediaOmxCommonDecoder::MediaOmxCommonDecoder(MediaDecoderOwner* aOwner) diff --git a/dom/media/omx/MediaOmxCommonReader.cpp b/dom/media/omx/MediaOmxCommonReader.cpp index 280bc26f35b2..2926ea940c10 100644 --- a/dom/media/omx/MediaOmxCommonReader.cpp +++ b/dom/media/omx/MediaOmxCommonReader.cpp @@ -23,7 +23,7 @@ using namespace android; namespace mozilla { -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define DECODER_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) MediaOmxCommonReader::MediaOmxCommonReader(AbstractMediaDecoder *aDecoder) diff --git a/dom/media/omx/MediaOmxReader.cpp b/dom/media/omx/MediaOmxReader.cpp index e67277cb37a4..65a370b260b1 100644 --- a/dom/media/omx/MediaOmxReader.cpp +++ b/dom/media/omx/MediaOmxReader.cpp @@ -28,7 +28,7 @@ using namespace android; namespace mozilla { -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define DECODER_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) class MediaOmxReader::ProcessCachedDataTask : public Task diff --git a/dom/media/omx/OmxDecoder.cpp b/dom/media/omx/OmxDecoder.cpp index 6427a313d151..531256ecad97 100644 --- a/dom/media/omx/OmxDecoder.cpp +++ b/dom/media/omx/OmxDecoder.cpp @@ -37,7 +37,7 @@ #define OD_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "OmxDecoder", __VA_ARGS__) #undef LOG -PRLogModuleInfo *gOmxDecoderLog; +mozilla::LazyLogModule gOmxDecoderLog("OmxDecoder"); #define LOG(type, msg...) MOZ_LOG(gOmxDecoderLog, type, (msg)) using namespace MPAPI; @@ -102,10 +102,6 @@ static sp GetOMX() bool OmxDecoder::Init(sp& extractor) { - if (!gOmxDecoderLog) { - gOmxDecoderLog = PR_NewLogModule("OmxDecoder"); - } - sp meta = extractor->getMetaData(); ssize_t audioTrackIndex = -1; diff --git a/dom/media/platforms/PlatformDecoderModule.cpp b/dom/media/platforms/PlatformDecoderModule.cpp index bb02119700bc..a2b979c374b0 100644 --- a/dom/media/platforms/PlatformDecoderModule.cpp +++ b/dom/media/platforms/PlatformDecoderModule.cpp @@ -6,10 +6,7 @@ #include "PlatformDecoderModule.h" -PRLogModuleInfo* GetPDMLog() { - static PRLogModuleInfo* log = nullptr; - if (!log) { - log = PR_NewLogModule("PlatformDecoderModule"); - } +mozilla::LogModule* GetPDMLog() { + static mozilla::LazyLogModule log("PlatformDecoderModule"); return log; } diff --git a/dom/media/platforms/agnostic/OpusDecoder.cpp b/dom/media/platforms/agnostic/OpusDecoder.cpp index 89e02079797b..252238548685 100644 --- a/dom/media/platforms/agnostic/OpusDecoder.cpp +++ b/dom/media/platforms/agnostic/OpusDecoder.cpp @@ -12,7 +12,7 @@ #include #include // For PRId64 -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define OPUS_DEBUG(arg, ...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, \ ("OpusDataDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) diff --git a/dom/media/platforms/agnostic/VPXDecoder.cpp b/dom/media/platforms/agnostic/VPXDecoder.cpp index 9a31ab653a96..2fb87f65080f 100644 --- a/dom/media/platforms/agnostic/VPXDecoder.cpp +++ b/dom/media/platforms/agnostic/VPXDecoder.cpp @@ -14,7 +14,7 @@ #include #undef LOG -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(arg, ...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, ("VPXDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/agnostic/VorbisDecoder.cpp b/dom/media/platforms/agnostic/VorbisDecoder.cpp index dce4c8a97e44..8f37a8fbc3ae 100644 --- a/dom/media/platforms/agnostic/VorbisDecoder.cpp +++ b/dom/media/platforms/agnostic/VorbisDecoder.cpp @@ -12,7 +12,7 @@ #include "nsAutoPtr.h" #undef LOG -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(type, msg) MOZ_LOG(GetPDMLog(), type, msg) namespace mozilla { diff --git a/dom/media/platforms/apple/AppleATDecoder.cpp b/dom/media/platforms/apple/AppleATDecoder.cpp index 578266e28f3a..fd8078208d67 100644 --- a/dom/media/platforms/apple/AppleATDecoder.cpp +++ b/dom/media/platforms/apple/AppleATDecoder.cpp @@ -11,7 +11,7 @@ #include "AppleATDecoder.h" #include "mozilla/Logging.h" -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #define FourCC2Str(n) ((char[5]){(char)(n >> 24), (char)(n >> 16), (char)(n >> 8), (char)(n), 0}) diff --git a/dom/media/platforms/apple/AppleCMLinker.cpp b/dom/media/platforms/apple/AppleCMLinker.cpp index d32119ba9068..a61cb0e9f2fe 100644 --- a/dom/media/platforms/apple/AppleCMLinker.cpp +++ b/dom/media/platforms/apple/AppleCMLinker.cpp @@ -15,7 +15,7 @@ #include "nsCocoaFeatures.h" #endif -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/apple/AppleVDADecoder.cpp b/dom/media/platforms/apple/AppleVDADecoder.cpp index 1851852ec1a2..8d1aebcade4c 100644 --- a/dom/media/platforms/apple/AppleVDADecoder.cpp +++ b/dom/media/platforms/apple/AppleVDADecoder.cpp @@ -27,7 +27,7 @@ #include "MacIOSurfaceImage.h" #endif -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) //#define LOG_MEDIA_SHA1 diff --git a/dom/media/platforms/apple/AppleVDALinker.cpp b/dom/media/platforms/apple/AppleVDALinker.cpp index 79f5c96d7422..045b1e24d311 100644 --- a/dom/media/platforms/apple/AppleVDALinker.cpp +++ b/dom/media/platforms/apple/AppleVDALinker.cpp @@ -10,7 +10,7 @@ #include "MainThreadUtils.h" #include "nsDebug.h" -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/apple/AppleVTDecoder.cpp b/dom/media/platforms/apple/AppleVTDecoder.cpp index 5432b41b110f..000f95c6389d 100644 --- a/dom/media/platforms/apple/AppleVTDecoder.cpp +++ b/dom/media/platforms/apple/AppleVTDecoder.cpp @@ -20,7 +20,7 @@ #include "VideoUtils.h" #include "gfxPlatform.h" -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) //#define LOG_MEDIA_SHA1 diff --git a/dom/media/platforms/apple/AppleVTLinker.cpp b/dom/media/platforms/apple/AppleVTLinker.cpp index a4f7e266045d..8adda2722548 100644 --- a/dom/media/platforms/apple/AppleVTLinker.cpp +++ b/dom/media/platforms/apple/AppleVTLinker.cpp @@ -11,7 +11,7 @@ #include "mozilla/ArrayUtils.h" #include "nsDebug.h" -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/ffmpeg/FFmpegLog.h b/dom/media/platforms/ffmpeg/FFmpegLog.h index 19b950bf46d8..eb1d22d99cab 100644 --- a/dom/media/platforms/ffmpeg/FFmpegLog.h +++ b/dom/media/platforms/ffmpeg/FFmpegLog.h @@ -7,7 +7,7 @@ #ifndef __FFmpegLog_h__ #define __FFmpegLog_h__ -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define FFMPEG_LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #endif // __FFmpegLog_h__ diff --git a/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp b/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp index 7dfa4b267c5b..e55feb14119b 100644 --- a/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp +++ b/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp @@ -27,7 +27,7 @@ #include #define GADM_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkAudioDecoderManager", __VA_ARGS__) -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) using namespace android; diff --git a/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp b/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp index 0ff303817b39..4bbf8acb6d12 100644 --- a/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp +++ b/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp @@ -20,7 +20,7 @@ #include #endif -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) using namespace android; diff --git a/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp b/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp index 4cd3ecb0955f..6a70a11be541 100644 --- a/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp +++ b/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp @@ -32,7 +32,7 @@ #include #define GVDM_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkVideoDecoderManager", __VA_ARGS__) -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) using namespace mozilla::layers; using namespace android; diff --git a/dom/media/platforms/wmf/MFTDecoder.cpp b/dom/media/platforms/wmf/MFTDecoder.cpp index 83ff91ba00e5..5558d6d7b2bf 100644 --- a/dom/media/platforms/wmf/MFTDecoder.cpp +++ b/dom/media/platforms/wmf/MFTDecoder.cpp @@ -9,7 +9,7 @@ #include "WMFUtils.h" #include "mozilla/Logging.h" -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/wmf/WMFAudioMFTManager.cpp b/dom/media/platforms/wmf/WMFAudioMFTManager.cpp index 1b8d361f1fa4..a2b5b518ed2b 100644 --- a/dom/media/platforms/wmf/WMFAudioMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFAudioMFTManager.cpp @@ -13,7 +13,7 @@ #include "mozilla/Logging.h" -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp index 5efca43a1a61..48cc4f6e535b 100644 --- a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp +++ b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp @@ -12,7 +12,7 @@ #include "mozilla/Logging.h" -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp index b82f0486a629..528155ad6810 100644 --- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp @@ -23,7 +23,7 @@ #include "mozilla/Preferences.h" #include "nsPrintfCString.h" -extern PRLogModuleInfo* GetPDMLog(); +extern mozilla::LogModule* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) using mozilla::layers::Image; diff --git a/dom/media/platforms/wrappers/FuzzingWrapper.cpp b/dom/media/platforms/wrappers/FuzzingWrapper.cpp index 2e58facf3eed..6b87a8fb5adb 100644 --- a/dom/media/platforms/wrappers/FuzzingWrapper.cpp +++ b/dom/media/platforms/wrappers/FuzzingWrapper.cpp @@ -6,11 +6,8 @@ #include "FuzzingWrapper.h" -PRLogModuleInfo* GetFuzzingWrapperLog() { - static PRLogModuleInfo* log = nullptr; - if (!log) { - log = PR_NewLogModule("MediaFuzzingWrapper"); - } +mozilla::LogModule* GetFuzzingWrapperLog() { + static mozilla::LazyLogModule log("MediaFuzzingWrapper"); return log; } #define DFW_LOGD(arg, ...) MOZ_LOG(GetFuzzingWrapperLog(), mozilla::LogLevel::Debug, ("DecoderFuzzingWrapper(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) diff --git a/dom/media/systemservices/CamerasChild.cpp b/dom/media/systemservices/CamerasChild.cpp index 44ad63cdad6a..d4adf6f024a8 100644 --- a/dom/media/systemservices/CamerasChild.cpp +++ b/dom/media/systemservices/CamerasChild.cpp @@ -22,7 +22,7 @@ #undef LOG #undef LOG_ENABLED -PRLogModuleInfo *gCamerasChildLog; +mozilla::LazyLogModule gCamerasChildLog("CamerasChild"); #define LOG(args) MOZ_LOG(gCamerasChildLog, mozilla::LogLevel::Debug, args) #define LOG_ENABLED() MOZ_LOG_TEST(gCamerasChildLog, mozilla::LogLevel::Debug) @@ -56,9 +56,6 @@ public: : mCamerasMutex("CamerasSingleton::mCamerasMutex"), mCameras(nullptr), mCamerasChildThread(nullptr) { - if (!gCamerasChildLog) { - gCamerasChildLog = PR_NewLogModule("CamerasChild"); - } LOG(("CamerasSingleton: %p", this)); } @@ -144,10 +141,6 @@ Cameras() { OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex()); if (!CamerasSingleton::Child()) { MOZ_ASSERT(!NS_IsMainThread(), "Should not be on the main Thread"); - if (!gCamerasChildLog) { - gCamerasChildLog = PR_NewLogModule("CamerasChild"); - } - MOZ_ASSERT(!CamerasSingleton::Thread()); LOG(("No sCameras, setting up IPC Thread")); nsresult rv = NS_NewNamedThread("Cameras IPC", @@ -706,10 +699,6 @@ CamerasChild::CamerasChild() mRequestMutex("mozilla::cameras::CamerasChild::mRequestMutex"), mReplyMonitor("mozilla::cameras::CamerasChild::mReplyMonitor") { - if (!gCamerasChildLog) { - gCamerasChildLog = PR_NewLogModule("CamerasChild"); - } - LOG(("CamerasChild: %p", this)); MOZ_COUNT_CTOR(CamerasChild); diff --git a/dom/media/systemservices/CamerasParent.cpp b/dom/media/systemservices/CamerasParent.cpp index df1c1ea56b67..e0e4ca1aa9ae 100644 --- a/dom/media/systemservices/CamerasParent.cpp +++ b/dom/media/systemservices/CamerasParent.cpp @@ -18,7 +18,7 @@ #undef LOG #undef LOG_ENABLED -PRLogModuleInfo *gCamerasParentLog; +mozilla::LazyLogModule gCamerasParentLog("CamerasParent"); #define LOG(args) MOZ_LOG(gCamerasParentLog, mozilla::LogLevel::Debug, args) #define LOG_ENABLED() MOZ_LOG_TEST(gCamerasParentLog, mozilla::LogLevel::Debug) @@ -852,9 +852,6 @@ CamerasParent::CamerasParent() mDestroyed(false), mWebRTCAlive(true) { - if (!gCamerasParentLog) { - gCamerasParentLog = PR_NewLogModule("CamerasParent"); - } LOG(("CamerasParent: %p", this)); mPBackgroundThread = NS_GetCurrentThread(); diff --git a/dom/media/systemservices/LoadManager.cpp b/dom/media/systemservices/LoadManager.cpp index 044af1f45f52..55506bab8d45 100644 --- a/dom/media/systemservices/LoadManager.cpp +++ b/dom/media/systemservices/LoadManager.cpp @@ -19,7 +19,7 @@ #include "mozilla/ArrayUtils.h" // NSPR_LOG_MODULES=LoadManager:5 -PRLogModuleInfo *gLoadManagerLog = nullptr; +mozilla::LazyLogModule gLoadManagerLog("LoadManager"); #undef LOG #undef LOG_ENABLED #define LOG(args) MOZ_LOG(gLoadManagerLog, mozilla::LogLevel::Debug, args) @@ -46,8 +46,6 @@ LoadManagerSingleton::LoadManagerSingleton(int aLoadMeasurementInterval, mHighLoadThreshold(aHighLoadThreshold), mLowLoadThreshold(aLowLoadThreshold) { - if (!gLoadManagerLog) - gLoadManagerLog = PR_NewLogModule("LoadManager"); LOG(("LoadManager - Initializing (%dms x %d, %f, %f)", mLoadMeasurementInterval, mAveragingMeasurements, mHighLoadThreshold, mLowLoadThreshold)); diff --git a/dom/media/systemservices/LoadManager.h b/dom/media/systemservices/LoadManager.h index 6088c73dce64..2ede35dbb2de 100644 --- a/dom/media/systemservices/LoadManager.h +++ b/dom/media/systemservices/LoadManager.h @@ -16,7 +16,7 @@ #include "webrtc/common_types.h" #include "webrtc/video_engine/include/vie_base.h" -extern PRLogModuleInfo *gLoadManagerLog; +extern mozilla::LazyLogModule gLoadManagerLog; namespace mozilla { diff --git a/dom/media/systemservices/MediaChild.cpp b/dom/media/systemservices/MediaChild.cpp index eb2d8a76e786..0ff3ac081762 100644 --- a/dom/media/systemservices/MediaChild.cpp +++ b/dom/media/systemservices/MediaChild.cpp @@ -13,7 +13,7 @@ #include "nsQueryObject.h" #undef LOG -PRLogModuleInfo *gMediaChildLog; +mozilla::LazyLogModule gMediaChildLog("MediaChild"); #define LOG(args) MOZ_LOG(gMediaChildLog, mozilla::LogLevel::Debug, args) namespace mozilla { @@ -68,9 +68,6 @@ Child* Child::Get() Child::Child() : mActorDestroyed(false) { - if (!gMediaChildLog) { - gMediaChildLog = PR_NewLogModule("MediaChild"); - } LOG(("media::Child: %p", this)); MOZ_COUNT_CTOR(Child); } diff --git a/dom/media/systemservices/MediaParent.cpp b/dom/media/systemservices/MediaParent.cpp index 84a32d41d501..4704c0ef5c7c 100644 --- a/dom/media/systemservices/MediaParent.cpp +++ b/dom/media/systemservices/MediaParent.cpp @@ -24,7 +24,7 @@ #include "mozilla/Logging.h" #undef LOG -PRLogModuleInfo *gMediaParentLog; +mozilla::LazyLogModule gMediaParentLog("MediaParent"); #define LOG(args) MOZ_LOG(gMediaParentLog, mozilla::LogLevel::Debug, args) // A file in the profile dir is used to persist mOriginKeys used to anonymize @@ -511,8 +511,6 @@ Parent::Parent(bool aSameProcess) , mDestroyed(false) , mSameProcess(aSameProcess) { - if (!gMediaParentLog) - gMediaParentLog = PR_NewLogModule("MediaParent"); LOG(("media::Parent: %p", this)); } diff --git a/dom/media/systemservices/OpenSLESProvider.cpp b/dom/media/systemservices/OpenSLESProvider.cpp index c15d71a22f78..8b417884e8f2 100644 --- a/dom/media/systemservices/OpenSLESProvider.cpp +++ b/dom/media/systemservices/OpenSLESProvider.cpp @@ -14,7 +14,7 @@ // NSPR_LOG_MODULES=OpenSLESProvider:5 #undef LOG #undef LOG_ENABLED -PRLogModuleInfo *gOpenSLESProviderLog; +mozilla::LazyLogModule gOpenSLESProviderLog("OpenSLESProvider"); #define LOG(args) MOZ_LOG(gOpenSLESProviderLog, mozilla::LogLevel::Debug, args) #define LOG_ENABLED() MOZ_LOG_TEST(gOpenSLESProviderLog, mozilla::LogLevel::Debug) @@ -27,8 +27,6 @@ OpenSLESProvider::OpenSLESProvider() mIsRealized(false), mOpenSLESLib(nullptr) { - if (!gOpenSLESProviderLog) - gOpenSLESProviderLog = PR_NewLogModule("OpenSLESProvider"); LOG(("OpenSLESProvider being initialized")); } diff --git a/dom/media/systemservices/OpenSLESProvider.h b/dom/media/systemservices/OpenSLESProvider.h index 2316dd862137..6253e9519ed4 100644 --- a/dom/media/systemservices/OpenSLESProvider.h +++ b/dom/media/systemservices/OpenSLESProvider.h @@ -28,7 +28,7 @@ SLresult mozilla_realize_sles_engine(SLObjectItf aObjectm); #ifdef __cplusplus #include "mozilla/Mutex.h" -extern PRLogModuleInfo *gOpenSLESProviderLog; +extern mozilla::LazyLogModule gOpenSLESProviderLog; namespace mozilla { diff --git a/dom/media/systemservices/ShmemPool.cpp b/dom/media/systemservices/ShmemPool.cpp index cd5e13e86f56..e4d3a054ffbf 100644 --- a/dom/media/systemservices/ShmemPool.cpp +++ b/dom/media/systemservices/ShmemPool.cpp @@ -11,7 +11,7 @@ #undef LOG #undef LOG_ENABLED -extern PRLogModuleInfo *gCamerasParentLog; +extern mozilla::LazyLogModule gCamerasParentLog; #define LOG(args) MOZ_LOG(gCamerasParentLog, mozilla::LogLevel::Debug, args) #define LOG_ENABLED() MOZ_LOG_TEST(gCamerasParentLog, mozilla::LogLevel::Debug) diff --git a/dom/media/wave/WaveReader.cpp b/dom/media/wave/WaveReader.cpp index 9cb7d7855bdc..ec820c73ee42 100644 --- a/dom/media/wave/WaveReader.cpp +++ b/dom/media/wave/WaveReader.cpp @@ -23,7 +23,7 @@ namespace mozilla { // Un-comment to enable logging of seek bisections. //#define SEEK_LOGGING -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; #define LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) #ifdef SEEK_LOGGING #define SEEK_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) diff --git a/dom/media/webm/AudioDecoder.cpp b/dom/media/webm/AudioDecoder.cpp index ac3fceca28f2..cd2bd0342318 100644 --- a/dom/media/webm/AudioDecoder.cpp +++ b/dom/media/webm/AudioDecoder.cpp @@ -28,7 +28,7 @@ namespace mozilla { -extern PRLogModuleInfo* gMediaDecoderLog; +extern LazyLogModule gMediaDecoderLog; ogg_packet InitOggPacket(const unsigned char* aData, size_t aLength, bool aBOS, bool aEOS, diff --git a/dom/media/webm/WebMDemuxer.cpp b/dom/media/webm/WebMDemuxer.cpp index d8687e094c25..80e75eb1d40c 100644 --- a/dom/media/webm/WebMDemuxer.cpp +++ b/dom/media/webm/WebMDemuxer.cpp @@ -32,8 +32,8 @@ namespace mozilla { using namespace gfx; -PRLogModuleInfo* gWebMDemuxerLog = nullptr; -extern PRLogModuleInfo* gNesteggLog; +LazyLogModule gWebMDemuxerLog("WebMDemuxer"); +extern LazyLogModule gNesteggLog; // How far ahead will we look when searching future keyframe. In microseconds. // This value is based on what appears to be a reasonable value as most webm @@ -145,12 +145,6 @@ WebMDemuxer::WebMDemuxer(MediaResource* aResource, bool aIsMediaSource) , mLastWebMBlockOffset(-1) , mIsMediaSource(aIsMediaSource) { - if (!gNesteggLog) { - gNesteggLog = PR_NewLogModule("Nestegg"); - } - if (!gWebMDemuxerLog) { - gWebMDemuxerLog = PR_NewLogModule("WebMDemuxer"); - } } WebMDemuxer::~WebMDemuxer() diff --git a/dom/media/webm/WebMReader.cpp b/dom/media/webm/WebMReader.cpp index 9095b5d1c328..4083d49483f3 100644 --- a/dom/media/webm/WebMReader.cpp +++ b/dom/media/webm/WebMReader.cpp @@ -39,8 +39,8 @@ using namespace gfx; using namespace layers; using namespace media; -extern PRLogModuleInfo* gMediaDecoderLog; -PRLogModuleInfo* gNesteggLog; +extern LazyLogModule gMediaDecoderLog; +LazyLogModule gNesteggLog("Nestegg"); // Functions for reading and seeking using MediaResource required for // nestegg_io. The 'user data' passed to these functions is the @@ -137,9 +137,6 @@ WebMReader::WebMReader(AbstractMediaDecoder* aDecoder) , mResource(aDecoder->GetResource()) { MOZ_COUNT_CTOR(WebMReader); - if (!gNesteggLog) { - gNesteggLog = PR_NewLogModule("Nestegg"); - } } WebMReader::~WebMReader() diff --git a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp index 789e67a9fd54..40c38f56990a 100644 --- a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp @@ -11,7 +11,7 @@ namespace mozilla { using namespace mozilla::gfx; using namespace mozilla::dom; -extern PRLogModuleInfo* GetMediaManagerLog(); +extern LogModule* GetMediaManagerLog(); #define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) #define LOGFRAME(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) diff --git a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp index 22fe90c1f253..33c565add981 100644 --- a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp @@ -25,7 +25,7 @@ using namespace mozilla::gfx; using namespace android; #undef LOG -extern PRLogModuleInfo* GetMediaManagerLog(); +extern LogModule* GetMediaManagerLog(); #define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) #define LOGFRAME(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) diff --git a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp index e2d898740dbf..319f8a2d1f38 100644 --- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp @@ -11,7 +11,7 @@ #include "MediaTrackConstraints.h" #include "CamerasChild.h" -extern PRLogModuleInfo* GetMediaManagerLog(); +extern mozilla::LogModule* GetMediaManagerLog(); #define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) #define LOGFRAME(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) diff --git a/dom/media/webrtc/MediaEngineWebRTC.cpp b/dom/media/webrtc/MediaEngineWebRTC.cpp index bac98880c871..650656c5c032 100644 --- a/dom/media/webrtc/MediaEngineWebRTC.cpp +++ b/dom/media/webrtc/MediaEngineWebRTC.cpp @@ -13,12 +13,10 @@ #include "mozilla/Logging.h" -static PRLogModuleInfo* +static mozilla::LogModule* GetUserMediaLog() { - static PRLogModuleInfo *sLog; - if (!sLog) - sLog = PR_NewLogModule("GetUserMedia"); + static mozilla::LazyLogModule sLog("GetUserMedia"); return sLog; } diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp index dd72ff0b3732..57c5ad2aff72 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -35,7 +35,7 @@ namespace mozilla { #undef LOG #endif -extern PRLogModuleInfo* GetMediaManagerLog(); +extern LogModule* GetMediaManagerLog(); #define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) #define LOG_FRAMES(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) diff --git a/dom/media/webspeech/recognition/SpeechRecognition.cpp b/dom/media/webspeech/recognition/SpeechRecognition.cpp index 0c2cb7f7a1a4..04e3862e0cef 100644 --- a/dom/media/webspeech/recognition/SpeechRecognition.cpp +++ b/dom/media/webspeech/recognition/SpeechRecognition.cpp @@ -56,14 +56,10 @@ static const uint32_t kSPEECH_DETECTION_TIMEOUT_MS = 10000; // kSAMPLE_RATE frames = 1s, kESTIMATION_FRAMES frames = 300ms static const uint32_t kESTIMATION_SAMPLES = 300 * kSAMPLE_RATE / 1000; -PRLogModuleInfo* +LogModule* GetSpeechRecognitionLog() { - static PRLogModuleInfo* sLog; - if (!sLog) { - sLog = PR_NewLogModule("SpeechRecognition"); - } - + static LazyLogModule sLog("SpeechRecognition"); return sLog; } #define SR_LOG(...) MOZ_LOG(GetSpeechRecognitionLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) diff --git a/dom/media/webspeech/recognition/SpeechRecognition.h b/dom/media/webspeech/recognition/SpeechRecognition.h index bce648ea6b8a..6fe4dc3bd98d 100644 --- a/dom/media/webspeech/recognition/SpeechRecognition.h +++ b/dom/media/webspeech/recognition/SpeechRecognition.h @@ -46,7 +46,7 @@ namespace dom { class GlobalObject; class SpeechEvent; -PRLogModuleInfo* GetSpeechRecognitionLog(); +LogModule* GetSpeechRecognitionLog(); #define SR_LOG(...) MOZ_LOG(GetSpeechRecognitionLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) class SpeechRecognition final : public DOMEventTargetHelper, diff --git a/dom/media/webspeech/synth/SpeechSynthesis.cpp b/dom/media/webspeech/synth/SpeechSynthesis.cpp index 1d9888841130..f0942b25becf 100644 --- a/dom/media/webspeech/synth/SpeechSynthesis.cpp +++ b/dom/media/webspeech/synth/SpeechSynthesis.cpp @@ -16,14 +16,10 @@ #include "nsIDocument.h" #undef LOG -PRLogModuleInfo* +mozilla::LogModule* GetSpeechSynthLog() { - static PRLogModuleInfo* sLog = nullptr; - - if (!sLog) { - sLog = PR_NewLogModule("SpeechSynthesis"); - } + static mozilla::LazyLogModule sLog("SpeechSynthesis"); return sLog; } diff --git a/dom/media/webspeech/synth/nsSpeechTask.cpp b/dom/media/webspeech/synth/nsSpeechTask.cpp index 149f1c5bd76c..01f56216f87a 100644 --- a/dom/media/webspeech/synth/nsSpeechTask.cpp +++ b/dom/media/webspeech/synth/nsSpeechTask.cpp @@ -18,7 +18,7 @@ #endif #undef LOG -extern PRLogModuleInfo* GetSpeechSynthLog(); +extern mozilla::LogModule* GetSpeechSynthLog(); #define LOG(type, msg) MOZ_LOG(GetSpeechSynthLog(), type, msg) #define AUDIO_TRACK 1 diff --git a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp index 3cf59f72e321..f1f5442deeb8 100644 --- a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp +++ b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp @@ -24,7 +24,7 @@ #include "SpeechSynthesisParent.h" #undef LOG -extern PRLogModuleInfo* GetSpeechSynthLog(); +extern mozilla::LogModule* GetSpeechSynthLog(); #define LOG(type, msg) MOZ_LOG(GetSpeechSynthLog(), type, msg) namespace { diff --git a/media/libstagefright/binding/MoofParser.cpp b/media/libstagefright/binding/MoofParser.cpp index f3c7a0e763c5..415ac353a32b 100644 --- a/media/libstagefright/binding/MoofParser.cpp +++ b/media/libstagefright/binding/MoofParser.cpp @@ -11,7 +11,7 @@ #include "mozilla/Logging.h" #if defined(MOZ_FMP4) -extern PRLogModuleInfo* GetDemuxerLog(); +extern mozilla::LogModule* GetDemuxerLog(); #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp index 49d63b31b6a1..991a3582355f 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp @@ -33,7 +33,7 @@ namespace mozilla { #endif #ifdef MOZILLA_INTERNAL_API -extern PRLogModuleInfo* GetGMPLog(); +extern mozilla::LogModule* GetGMPLog(); #else // For CPP unit tests PRLogModuleInfo*