Bug 1348783 - use LazyLogModule for AudioChannel logging.
LazyLog can be used easily via adding the pref("logging.MODULE_NAME", DEBUG_LEVEL).
It's more convenient than PRLog.
MozReview-Commit-ID: T7uSxVAiN3
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -31,16 +31,18 @@
#endif
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::hal;
+static mozilla::LazyLogModule gAudioChannelLog("AudioChannel");
+
namespace {
// If true, any new AudioChannelAgent will be muted when created.
bool sAudioChannelMutedByDefault = false;
bool sAudioChannelCompeting = false;
bool sAudioChannelCompetingAllAgents = false;
bool sXPCOMShuttingDown = false;
@@ -221,23 +223,19 @@ AudioChannelService::Get()
if (sXPCOMShuttingDown) {
return nullptr;
}
RefPtr<AudioChannelService> service = gAudioChannelService.get();
return service.forget();
}
-/* static */ PRLogModuleInfo*
+/* static */ LogModule*
AudioChannelService::GetAudioChannelLog()
{
- static PRLogModuleInfo *gAudioChannelLog;
- if (!gAudioChannelLog) {
- gAudioChannelLog = PR_NewLogModule("AudioChannel");
- }
return gAudioChannelLog;
}
/* static */ void
AudioChannelService::Shutdown()
{
if (gAudioChannelService) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
--- a/dom/audiochannel/AudioChannelService.h
+++ b/dom/audiochannel/AudioChannelService.h
@@ -11,16 +11,17 @@
#include "nsAutoPtr.h"
#include "nsIObserver.h"
#include "nsTObserverArray.h"
#include "nsTArray.h"
#include "AudioChannelAgent.h"
#include "nsAttrValue.h"
#include "mozilla/dom/AudioChannelBinding.h"
+#include "mozilla/Logging.h"
#include <functional>
class nsIRunnable;
class nsPIDOMWindowOuter;
struct PRLogModuleInfo;
namespace mozilla {
@@ -97,17 +98,17 @@ public:
/**
* Returns the AudioChannelService singleton if one exists.
* If AudioChannelService doesn't exist, returns null.
*/
static already_AddRefed<AudioChannelService> Get();
static bool IsAudioChannelMutedByDefault();
- static PRLogModuleInfo* GetAudioChannelLog();
+ static LogModule* GetAudioChannelLog();
static bool IsEnableAudioCompeting();
/**
* Any audio channel agent that starts playing should register itself to
* this service, sharing the AudioChannel.
*/
void RegisterAudioChannelAgent(AudioChannelAgent* aAgent,