Bug 1620113 - part3 : rename function names to explicitly mention that they're used for main controller. r=chunmin
authoralwu <alwu@mozilla.com>
Sat, 21 Mar 2020 01:04:27 +0000
changeset 520627 1185f5a8daf848069785f9ac35216a2f2ef7174c
parent 520626 d3f1873dfae9d4ab0386d0c5893bbe1a784d9cc1
child 520628 5241e4aab772ac8c55999c144731313360d85e5e
push id37254
push usernerli@mozilla.com
push dateFri, 27 Mar 2020 04:48:07 +0000
treeherdermozilla-central@2d758b42bd73 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschunmin
bugs1620113
milestone76.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 1620113 - part3 : rename function names to explicitly mention that they're used for main controller. r=chunmin Differential Revision: https://phabricator.services.mozilla.com/D66856
dom/media/mediacontrol/MediaControlService.cpp
dom/media/mediacontrol/MediaControlService.h
--- a/dom/media/mediacontrol/MediaControlService.cpp
+++ b/dom/media/mediacontrol/MediaControlService.cpp
@@ -192,29 +192,29 @@ bool MediaControlService::ControllerMana
   return true;
 }
 
 void MediaControlService::ControllerManager::Shutdown() {
   mControllers.clear();
   DisconnectMainControllerEvents();
 }
 
-void MediaControlService::ControllerManager::ControllerPlaybackStateChanged(
+void MediaControlService::ControllerManager::MainControllerPlaybackStateChanged(
     MediaSessionPlaybackState aState) {
   MOZ_ASSERT(NS_IsMainThread());
   mSource->SetPlaybackState(aState);
   if (StaticPrefs::media_mediacontrol_testingevents_enabled()) {
     if (nsCOMPtr<nsIObserverService> obs = services::GetObserverService()) {
       obs->NotifyObservers(nullptr, "main-media-controller-playback-changed",
                            nullptr);
     }
   }
 }
 
-void MediaControlService::ControllerManager::ControllerMetadataChanged(
+void MediaControlService::ControllerManager::MainControllerMetadataChanged(
     const MediaMetadataBase& aMetadata) {
   MOZ_ASSERT(NS_IsMainThread());
   mSource->SetMediaMetadata(aMetadata);
 }
 
 void MediaControlService::ControllerManager::UpdateMainController(
     MediaController* aController) {
   MOZ_ASSERT(NS_IsMainThread());
@@ -241,20 +241,20 @@ void MediaControlService::ControllerMana
 
 void MediaControlService::ControllerManager::ConnectToMainControllerEvents() {
   MOZ_ASSERT(mMainController);
   // Listen to main controller's event in order to get its playback state and
   // metadata update.
   mPlayStateChangedListener =
       mMainController->PlaybackStateChangedEvent().Connect(
           AbstractThread::MainThread(), this,
-          &ControllerManager::ControllerPlaybackStateChanged);
+          &ControllerManager::MainControllerPlaybackStateChanged);
   mMetadataChangedListener = mMainController->MetadataChangedEvent().Connect(
       AbstractThread::MainThread(), this,
-      &ControllerManager::ControllerMetadataChanged);
+      &ControllerManager::MainControllerMetadataChanged);
 
   // Update controller's current status to the event source.
   mSource->SetPlaybackState(mMainController->GetState());
   mSource->SetMediaMetadata(mMainController->GetCurrentMediaMetadata());
 }
 
 void MediaControlService::ControllerManager::DisconnectMainControllerEvents() {
   mPlayStateChangedListener.DisconnectIfExists();
--- a/dom/media/mediacontrol/MediaControlService.h
+++ b/dom/media/mediacontrol/MediaControlService.h
@@ -96,19 +96,19 @@ class MediaControlService final : public
     bool RemoveController(MediaController* aController);
 
     void Shutdown();
 
     MediaController* GetMainController() const;
     MediaController* GetControllerById(uint64_t aId) const;
     uint64_t GetControllersNum() const;
 
-    // Callback functions for monitoring main controller's status change.
-    void ControllerPlaybackStateChanged(MediaSessionPlaybackState aState);
-    void ControllerMetadataChanged(const MediaMetadataBase& aMetadata);
+    // These functions are used for monitoring main controller's status change.
+    void MainControllerPlaybackStateChanged(MediaSessionPlaybackState aState);
+    void MainControllerMetadataChanged(const MediaMetadataBase& aMetadata);
 
    private:
     void UpdateMainController(MediaController* aController);
     void ConnectToMainControllerEvents();
     void DisconnectMainControllerEvents();
 
     LinkedList<RefPtr<MediaController>> mControllers;
     RefPtr<MediaController> mMainController;