Bug 1177259 - Improve the names of the methods of nsIAudioChannelAgent, r=alwu
authorAndrea Marchesini <amarchesini@mozilla.com>
Sat, 11 Jul 2015 08:24:26 +0100
changeset 284150 1d8ca0f7fc99c49c628975ae8054b7de397d2028
parent 284149 cc4991e7fc83917adb82660799d33ee1944188f4
child 284151 ede8c12c61487f61991c1283f3f00f719fe40ac7
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersalwu
bugs1177259
milestone42.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 1177259 - Improve the names of the methods of nsIAudioChannelAgent, r=alwu
CLOBBER
dom/audiochannel/AudioChannelAgent.cpp
dom/audiochannel/nsIAudioChannelAgent.idl
dom/camera/DOMCameraControl.cpp
dom/fmradio/FMRadio.cpp
dom/html/HTMLMediaElement.cpp
dom/media/webaudio/AudioDestinationNode.cpp
dom/system/gonk/AudioManager.cpp
--- a/CLOBBER
+++ b/CLOBBER
@@ -17,9 +17,9 @@
 #
 # Modifying this file will now automatically clobber the buildbot machines \o/
 #
 
 # Are you updating CLOBBER because you think it's needed for your WebIDL
 # changes to stick? As of bug 928195, this shouldn't be necessary! Please
 # don't change CLOBBER for WebIDL changes any more.
 
-Bug 1178892 requires clobber for profiler file moves.
+Bug 1113086 requires clobber for a cpp test that is somehow in the cache of the existing builds.
--- a/dom/audiochannel/AudioChannelAgent.cpp
+++ b/dom/audiochannel/AudioChannelAgent.cpp
@@ -26,17 +26,17 @@ AudioChannelAgent::AudioChannelAgent()
   : mAudioChannelType(AUDIO_AGENT_CHANNEL_ERROR)
   , mIsRegToService(false)
 {
 }
 
 AudioChannelAgent::~AudioChannelAgent()
 {
   if (mIsRegToService) {
-    StopPlaying();
+    NotifyStoppedPlaying();
   }
 }
 
 /* readonly attribute long audioChannelType; */
 NS_IMETHODIMP AudioChannelAgent::GetAudioChannelType(int32_t *aAudioChannelType)
 {
   *aAudioChannelType = mAudioChannelType;
   return NS_OK;
@@ -104,18 +104,19 @@ AudioChannelAgent::InitInternal(nsIDOMWi
     mWeakCallback = do_GetWeakReference(aCallback);
   } else {
     mCallback = aCallback;
   }
 
   return NS_OK;
 }
 
-/* boolean startPlaying (); */
-NS_IMETHODIMP AudioChannelAgent::StartPlaying(float *aVolume, bool* aMuted)
+/* boolean notifyStartedPlaying (); */
+NS_IMETHODIMP AudioChannelAgent::NotifyStartedPlaying(float *aVolume,
+                                                      bool* aMuted)
 {
   MOZ_ASSERT(aVolume);
   MOZ_ASSERT(aMuted);
 
   nsRefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
   if (mAudioChannelType == AUDIO_AGENT_CHANNEL_ERROR ||
       service == nullptr || mIsRegToService) {
     return NS_ERROR_FAILURE;
@@ -125,18 +126,18 @@ NS_IMETHODIMP AudioChannelAgent::StartPl
     static_cast<AudioChannel>(mAudioChannelType));
 
   service->GetState(mWindow, mAudioChannelType, aVolume, aMuted);
 
   mIsRegToService = true;
   return NS_OK;
 }
 
-/* void stopPlaying (); */
-NS_IMETHODIMP AudioChannelAgent::StopPlaying(void)
+/* void notifyStoppedPlaying (); */
+NS_IMETHODIMP AudioChannelAgent::NotifyStoppedPlaying(void)
 {
   if (mAudioChannelType == AUDIO_AGENT_CHANNEL_ERROR ||
       !mIsRegToService) {
     return NS_ERROR_FAILURE;
   }
 
   nsRefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
   service->UnregisterAudioChannelAgent(this);
--- a/dom/audiochannel/nsIAudioChannelAgent.idl
+++ b/dom/audiochannel/nsIAudioChannelAgent.idl
@@ -24,17 +24,17 @@ interface nsIAudioChannelAgentCallback :
  *   3. Notifying the agent when they start/stop using this channel.
  *   4. Notifying the agent of changes to the visibility of the component using
  *      this channel.
  *
  * The agent will invoke a callback to notify Gecko components of
  *   1. Changes to the playable status of this channel.
  */
 
-[uuid(11138a74-ee64-4a91-9457-f60a5f4527c1)]
+[uuid(e28e1569-2a44-4f71-9cd0-216874b05d57)]
 interface nsIAudioChannelAgent : nsISupports
 {
   const long AUDIO_AGENT_CHANNEL_NORMAL             = 0;
   const long AUDIO_AGENT_CHANNEL_CONTENT            = 1;
   const long AUDIO_AGENT_CHANNEL_NOTIFICATION       = 2;
   const long AUDIO_AGENT_CHANNEL_ALARM              = 3;
   const long AUDIO_AGENT_CHANNEL_TELEPHONY          = 4;
   const long AUDIO_AGENT_CHANNEL_RINGER             = 5;
@@ -96,20 +96,20 @@ interface nsIAudioChannelAgent : nsISupp
    * @return
    *    normal state: the agent has registered with audio channel service and
    *          the component should start playback.
    *    muted state: the agent has registered with audio channel service but
    *          the component should not start playback.
    *    faded state: the agent has registered with audio channel service the
    *          component should start playback as well as reducing the volume.
    */
-  void startPlaying(out float volume, out bool muted);
+  void notifyStartedPlaying(out float volume, out bool muted);
 
   /**
    * Notify the agent we no longer want to play.
    *
-   * Note : even if startPlaying() returned false, the agent would still be
-   *        registered with the audio channel service and receive callbacks for status changes.
-   *        So stopPlaying must still eventually be called to unregister the agent with the
-   *        channel service.
+   * Note : even if notifyStartedPlaying() returned false, the agent would
+   * still be registered with the audio channel service and receive callbacks
+   * for status changes. So notifyStoppedPlaying must still eventually be
+   * called to unregister the agent with the channel service.
    */
-  void stopPlaying();
+  void notifyStoppedPlaying();
 };
--- a/dom/camera/DOMCameraControl.cpp
+++ b/dom/camera/DOMCameraControl.cpp
@@ -1096,17 +1096,17 @@ nsDOMCameraControl::Shutdown()
   }
 }
 
 void
 nsDOMCameraControl::ReleaseAudioChannelAgent()
 {
 #ifdef MOZ_B2G
   if (mAudioChannelAgent) {
-    mAudioChannelAgent->StopPlaying();
+    mAudioChannelAgent->NotifyStoppedPlaying();
     mAudioChannelAgent = nullptr;
   }
 #endif
 }
 
 nsresult
 nsDOMCameraControl::NotifyRecordingStatusChange(const nsString& aMsg)
 {
@@ -1132,17 +1132,17 @@ nsDOMCameraControl::NotifyRecordingStatu
       return NS_ERROR_UNEXPECTED;
     }
 
     // Camera app will stop recording when it falls to the background, so no callback is necessary.
     mAudioChannelAgent->Init(mWindow, (int32_t)AudioChannel::Content, nullptr);
     // Video recording doesn't output any sound, so it's not necessary to check canPlay.
     float volume = 0.0;
     bool muted = true;
-    rv = mAudioChannelAgent->StartPlaying(&volume, &muted);
+    rv = mAudioChannelAgent->NotifyStartedPlaying(&volume, &muted);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 #endif
   return rv;
 }
 
--- a/dom/fmradio/FMRadio.cpp
+++ b/dom/fmradio/FMRadio.cpp
@@ -190,17 +190,17 @@ FMRadio::Notify(const FMRadioEventType& 
     case FrequencyChanged:
       DispatchTrustedEvent(NS_LITERAL_STRING("frequencychange"));
       break;
     case EnabledChanged:
       if (Enabled()) {
         DispatchTrustedEvent(NS_LITERAL_STRING("enabled"));
       } else {
         if (mAudioChannelAgentEnabled) {
-          mAudioChannelAgent->StopPlaying();
+          mAudioChannelAgent->NotifyStoppedPlaying();
           mAudioChannelAgentEnabled = false;
         }
 
         DispatchTrustedEvent(NS_LITERAL_STRING("disabled"));
       }
       break;
     case RDSEnabledChanged:
       if (RdsEnabled()) {
@@ -452,17 +452,17 @@ FMRadio::DisableRDS()
 
 void
 FMRadio::EnableAudioChannelAgent()
 {
   NS_ENSURE_TRUE_VOID(mAudioChannelAgent);
 
   float volume = 0.0;
   bool muted = true;
-  mAudioChannelAgent->StartPlaying(&volume, &muted);
+  mAudioChannelAgent->NotifyStartedPlaying(&volume, &muted);
   WindowVolumeChanged(volume, muted);
 
   mAudioChannelAgentEnabled = true;
 }
 
 NS_IMETHODIMP
 FMRadio::WindowVolumeChanged(float aVolume, bool aMuted)
 {
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -4513,20 +4513,20 @@ void HTMLMediaElement::UpdateAudioChanne
     // This is needed to pass nsContentUtils::IsCallerChrome().
     // AudioChannel API should not called from content but it can happen that
     // this method has some content JS in its stack.
     AutoNoJSAPI nojsapi;
 
     if (mPlayingThroughTheAudioChannel) {
       float volume = 0.0;
       bool muted = true;
-      mAudioChannelAgent->StartPlaying(&volume, &muted);
+      mAudioChannelAgent->NotifyStartedPlaying(&volume, &muted);
       WindowVolumeChanged(volume, muted);
     } else {
-      mAudioChannelAgent->StopPlaying();
+      mAudioChannelAgent->NotifyStoppedPlaying();
       mAudioChannelAgent = nullptr;
     }
   }
 }
 
 NS_IMETHODIMP HTMLMediaElement::WindowVolumeChanged(float aVolume, bool aMuted)
 {
   NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
--- a/dom/media/webaudio/AudioDestinationNode.cpp
+++ b/dom/media/webaudio/AudioDestinationNode.cpp
@@ -368,17 +368,17 @@ AudioDestinationNode::SizeOfIncludingThi
 {
   return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
 }
 
 void
 AudioDestinationNode::DestroyAudioChannelAgent()
 {
   if (mAudioChannelAgent && !Context()->IsOffline()) {
-    mAudioChannelAgent->StopPlaying();
+    mAudioChannelAgent->NotifyStoppedPlaying();
     mAudioChannelAgent = nullptr;
   }
 }
 
 void
 AudioDestinationNode::DestroyMediaStream()
 {
   DestroyAudioChannelAgent();
@@ -575,17 +575,17 @@ AudioDestinationNode::CheckAudioChannelP
 void
 AudioDestinationNode::CreateAudioChannelAgent()
 {
   if (mIsOffline || !UseAudioChannelService()) {
     return;
   }
 
   if (mAudioChannelAgent) {
-    mAudioChannelAgent->StopPlaying();
+    mAudioChannelAgent->NotifyStoppedPlaying();
   }
 
   mAudioChannelAgent = new AudioChannelAgent();
   mAudioChannelAgent->InitWithWeakCallback(GetOwner(),
                                            static_cast<int32_t>(mAudioChannel),
                                            this);
 
   // The AudioChannelAgent must start playing immediately in order to avoid
@@ -666,23 +666,23 @@ AudioDestinationNode::InputMuted(bool aM
 {
   MOZ_ASSERT(Context() && !Context()->IsOffline());
 
   if (!mAudioChannelAgent) {
     return;
   }
 
   if (aMuted) {
-    mAudioChannelAgent->StopPlaying();
+    mAudioChannelAgent->NotifyStoppedPlaying();
     return;
   }
 
   float volume = 0.0;
   bool muted = true;
-  nsresult rv = mAudioChannelAgent->StartPlaying(&volume, &muted);
+  nsresult rv = mAudioChannelAgent->NotifyStartedPlaying(&volume, &muted);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return;
   }
 
   WindowVolumeChanged(volume, muted);
 }
 
 } // dom namespace
--- a/dom/system/gonk/AudioManager.cpp
+++ b/dom/system/gonk/AudioManager.cpp
@@ -342,17 +342,17 @@ void
 AudioManager::HandleAudioChannelProcessChanged()
 {
   // Note: If the user answers a VoIP call (e.g. WebRTC calls) during the
   // telephony call (GSM/CDMA calls) the audio manager won't set the
   // PHONE_STATE_IN_COMMUNICATION audio state. Once the telephony call finishes
   // the RIL plumbing sets the PHONE_STATE_NORMAL audio state. This seems to be
   // an issue for the VoIP call but it is not. Once the RIL plumbing sets the
   // the PHONE_STATE_NORMAL audio state the AudioManager::mPhoneAudioAgent
-  // member will call the StopPlaying() method causing that this function will
+  // member will call the NotifyStoppedPlaying() method causing that this function will
   // be called again and therefore the audio manager sets the
   // PHONE_STATE_IN_COMMUNICATION audio state.
 
   if ((mPhoneState == PHONE_STATE_IN_CALL) ||
       (mPhoneState == PHONE_STATE_RINGTONE)) {
     return;
   }
 
@@ -631,17 +631,17 @@ AudioManager::SetPhoneState(int32_t aSta
   if (AudioSystem::setPhoneState(static_cast<audio_mode_t>(aState))) {
 #endif
     return NS_ERROR_FAILURE;
   }
 
   mPhoneState = aState;
 
   if (mPhoneAudioAgent) {
-    mPhoneAudioAgent->StopPlaying();
+    mPhoneAudioAgent->NotifyStoppedPlaying();
     mPhoneAudioAgent = nullptr;
   }
 
   if (aState == PHONE_STATE_IN_CALL || aState == PHONE_STATE_RINGTONE) {
     mPhoneAudioAgent = do_CreateInstance("@mozilla.org/audiochannelagent;1");
     MOZ_ASSERT(mPhoneAudioAgent);
     if (aState == PHONE_STATE_IN_CALL) {
       // Telephony doesn't be paused by any other channels.
@@ -649,17 +649,17 @@ AudioManager::SetPhoneState(int32_t aSta
     } else {
       mPhoneAudioAgent->Init(nullptr, (int32_t)AudioChannel::Ringer, nullptr);
     }
 
     // Telephony can always play.
     float volume = 0.0;
     bool muted = true;
 
-    nsresult rv = mPhoneAudioAgent->StartPlaying(&volume, &muted);
+    nsresult rv = mPhoneAudioAgent->NotifyStartedPlaying(&volume, &muted);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   return NS_OK;
 }