Bug 1361336 - Part 6: Apply AudioNotificationSender/Receiver in ContentParent/Child. r=cpearce, a=lizzard
authorChun-Min Chang <chun.m.chang@gmail.com>
Tue, 25 Jul 2017 12:34:14 +0800
changeset 421659 a4605a256ecda20c88baf1499ab0fc6a3d32fdff
parent 421658 18e55ae0fc5348e7ae7967fa46c547fdf6e032a2
child 421660 abfc6cba67470808a1a4a0bb73598d6cb052f749
push id7736
push userryanvm@gmail.com
push dateMon, 11 Sep 2017 15:47:51 +0000
treeherdermozilla-beta@94cf7f1ee06b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, lizzard
bugs1361336
milestone56.0
Bug 1361336 - Part 6: Apply AudioNotificationSender/Receiver in ContentParent/Child. r=cpearce, a=lizzard
dom/ipc/ContentChild.cpp
dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -163,16 +163,17 @@
 #if defined(MOZ_WIDGET_ANDROID)
 #include "APKOpen.h"
 #endif
 
 #ifdef XP_WIN
 #include <process.h>
 #define getpid _getpid
 #include "mozilla/widget/AudioSession.h"
+#include "mozilla/audio/AudioNotificationReceiver.h"
 #endif
 
 #ifdef MOZ_X11
 #include "mozilla/X11Util.h"
 #endif
 
 #ifdef ACCESSIBILITY
 #include "nsAccessibilityService.h"
@@ -1329,16 +1330,19 @@ ContentChild::RecvReinitRendering(Endpoi
 
   VideoDecoderManagerChild::InitForContent(Move(aVideoManager));
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvAudioDefaultDeviceChange()
 {
+#ifdef XP_WIN
+  audio::AudioNotificationReceiver::NotifyDefaultDeviceChanged();
+#endif
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvReinitRenderingForDeviceReset()
 {
   gfxPlatform::GetPlatform()->CompositorUpdated();
 
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -230,16 +230,17 @@
 #endif
 #endif
 
 #ifdef MOZ_TOOLKIT_SEARCH
 #include "nsIBrowserSearchService.h"
 #endif
 
 #ifdef XP_WIN
+#include "mozilla/audio/AudioNotificationSender.h"
 #include "mozilla/widget/AudioSession.h"
 #endif
 
 #ifdef MOZ_CRASHREPORTER
 #include "nsThread.h"
 #include "mozilla/ipc/CrashReporterHost.h"
 #endif
 
@@ -2129,22 +2130,27 @@ ContentParent::ContentParent(ContentPare
     sContentParents = new LinkedList<ContentParent>();
   }
   sContentParents->insertBack(this);
 
   // From this point on, NS_WARNING, NS_ASSERTION, etc. should print out the
   // PID along with the warning.
   nsDebugImpl::SetMultiprocessMode("Parent");
 
-#if defined(XP_WIN) && !defined(MOZ_B2G)
+#if defined(XP_WIN)
+  if (XRE_IsParentProcess()) {
+    audio::AudioNotificationSender::Init();
+  }
+#if !defined(MOZ_B2G)
   // Request Windows message deferral behavior on our side of the PContent
   // channel. Generally only applies to the situation where we get caught in
   // a deadlock with the plugin process when sending CPOWs.
   GetIPCChannel()->SetChannelFlags(MessageChannel::REQUIRE_DEFERRED_MESSAGE_PROTECTION);
 #endif
+#endif
 
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
   ChildPrivileges privs = mRemoteType.EqualsLiteral(FILE_REMOTE_TYPE)
                           ? base::PRIVILEGES_FILEREAD
                           : base::PRIVILEGES_DEFAULT;
   mSubprocess = new GeckoChildProcessHost(GeckoProcessType_Content, privs);
 }