Bug 1361336 - part6: Apply AudioNotificationSender/Receiver in ContentParent/Child; r=cpearce
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -165,16 +165,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"
@@ -1337,16 +1338,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
@@ -232,16 +232,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
@@ -2130,22 +2131,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);
}