Bug 1458383 - Don't dispatch mediaBlockStop notification. r=baku
authorChris Pearce <cpearce@mozilla.com>
Wed, 09 May 2018 16:22:40 +1200
changeset 418254 97e9b87a9a553e6e3863d3ed96860570bf1bd526
parent 418253 510dfe436e4ecbfcecb5e01d5b476d749094a791
child 418255 74dc3b5bb9aa99a041a48a9a096e05168b294bb6
push id63972
push usercpearce@mozilla.com
push dateTue, 15 May 2018 01:01:22 +0000
treeherderautoland@74dc3b5bb9aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1458383, 1347791
milestone62.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 1458383 - Don't dispatch mediaBlockStop notification. r=baku This is a partial backout of Bug 1347791 part 3; a5fbb7e2d1d0. We don't need to track in the front end code when a tab is foregrounded, so we don't need to dispatch this message any more. MozReview-Commit-ID: 6M0n9Ik65vE
dom/audiochannel/AudioChannelService.cpp
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -786,35 +786,19 @@ AudioChannelService::AudioChannelWindow:
   AudioAudibleChanged(aAgent,
                       AudibleState::eNotAudible,
                       AudibleChangedReasons::ePauseStateChanged);
 }
 
 void
 AudioChannelService::AudioChannelWindow::NotifyMediaBlockStop(nsPIDOMWindowOuter* aWindow)
 {
-  // Can't use raw pointer for lamba variable capturing, use smart ptr.
-  nsCOMPtr<nsPIDOMWindowOuter> window = aWindow;
-  NS_DispatchToCurrentThread(NS_NewRunnableFunction(
-    "dom::AudioChannelService::AudioChannelWindow::NotifyMediaBlockStop",
-    [window]() -> void {
-      nsCOMPtr<nsIObserverService> observerService =
-        services::GetObserverService();
-      if (NS_WARN_IF(!observerService)) {
-        return;
-      }
-
-      observerService->NotifyObservers(ToSupports(window),
-                                       "audio-playback",
-                                       u"mediaBlockStop");
-    })
-  );
-
   if (mShouldSendActiveMediaBlockStopEvent) {
     mShouldSendActiveMediaBlockStopEvent = false;
+    nsCOMPtr<nsPIDOMWindowOuter> window = aWindow;
     NS_DispatchToCurrentThread(NS_NewRunnableFunction(
       "dom::AudioChannelService::AudioChannelWindow::NotifyMediaBlockStop",
       [window]() -> void {
         nsCOMPtr<nsIObserverService> observerService =
           services::GetObserverService();
         if (NS_WARN_IF(!observerService)) {
           return;
         }