Bug 1593131 - part6 : modify log name. r=chunmin
authoralwu <alwu@mozilla.com>
Thu, 14 Nov 2019 01:16:47 +0000
changeset 502055 f0ceeb68fff9ceb3d8ec9f7915695a8ed8ae9e27
parent 502054 55fe1b2e71c4c12aee2f132db87a46e0bf5fa8f3
child 502056 5df0e903d13fa096db7b3d90c3d1fe972a5b34d4
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschunmin
bugs1593131
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1593131 - part6 : modify log name. r=chunmin Differential Revision: https://phabricator.services.mozilla.com/D52708
dom/media/mediacontrol/MediaControlKeysEvent.cpp
--- a/dom/media/mediacontrol/MediaControlKeysEvent.cpp
+++ b/dom/media/mediacontrol/MediaControlKeysEvent.cpp
@@ -7,22 +7,16 @@
 #include "MediaControlKeysEvent.h"
 
 #include "MediaControlUtils.h"
 #include "MediaControlService.h"
 #include "mozilla/Logging.h"
 
 extern mozilla::LazyLogModule gMediaControlLog;
 
-// avoid redefined macro in unified build
-#undef LOG
-#define LOG(msg, ...)                        \
-  MOZ_LOG(gMediaControlLog, LogLevel::Debug, \
-          ("MediaControlKeysEventListener=%p, " msg, this, ##__VA_ARGS__))
-
 namespace mozilla {
 namespace dom {
 
 static const char* ToMediaControlKeysEventStr(MediaControlKeysEvent aKeyEvent) {
   switch (aKeyEvent) {
     case MediaControlKeysEvent::ePlayPause:
       return "PlayPause";
     case MediaControlKeysEvent::eNext:
@@ -30,21 +24,27 @@ static const char* ToMediaControlKeysEve
     case MediaControlKeysEvent::ePrev:
       return "Prev";
     default:
       MOZ_ASSERT_UNREACHABLE("Invalid action.");
   }
   return "Unknown";
 }
 
+// avoid redefined macro in unified build
+#undef LOG_SOURCE
+#define LOG_SOURCE(msg, ...)                 \
+  MOZ_LOG(gMediaControlLog, LogLevel::Debug, \
+          ("MediaControlKeysEventSource=%p, " msg, this, ##__VA_ARGS__))
+
 #undef LOG_KEY
 #define LOG_KEY(msg, key, ...)                                    \
   if (MOZ_LOG_TEST(gMediaControlLog, mozilla::LogLevel::Debug)) { \
     MOZ_LOG(gMediaControlLog, LogLevel::Debug,                    \
-            ("MediaControlKeysEventListener=%p, " msg, this,      \
+            ("MediaControlKeysHandler=%p, " msg, this,            \
              ToMediaControlKeysEventStr(key), ##__VA_ARGS__));    \
   }
 
 NS_IMPL_ISUPPORTS0(MediaControlKeysHandler)
 
 void MediaControlKeysHandler::OnKeyPressed(MediaControlKeysEvent aKeyEvent) {
   LOG_KEY("OnKeyPressed '%s'", aKeyEvent);
   switch (aKeyEvent) {
@@ -73,27 +73,30 @@ void MediaControlKeysHandler::OnKeyPress
   }
 }
 
 NS_IMPL_ISUPPORTS0(MediaControlKeysEventSource)
 
 void MediaControlKeysEventSource::AddListener(
     MediaControlKeysEventListener* aListener) {
   MOZ_ASSERT(aListener);
-  LOG("Add listener %p", aListener);
+  LOG_SOURCE("Add listener %p", aListener);
   mListeners.AppendElement(aListener);
 }
 
 void MediaControlKeysEventSource::RemoveListener(
     MediaControlKeysEventListener* aListener) {
   MOZ_ASSERT(aListener);
-  LOG("Remove listener %p", aListener);
+  LOG_SOURCE("Remove listener %p", aListener);
   mListeners.RemoveElement(aListener);
 }
 
 size_t MediaControlKeysEventSource::GetListenersNum() const {
   return mListeners.Length();
 }
 
-void MediaControlKeysEventSource::Close() { mListeners.Clear(); }
+void MediaControlKeysEventSource::Close() {
+  LOG_SOURCE("Close source");
+  mListeners.Clear();
+}
 
 }  // namespace dom
 }  // namespace mozilla