bug 1208327 make enum AudioContextOperation strongly typed and forward declare instead of including AudioContext.h r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 25 Sep 2015 08:49:03 +1200
changeset 264577 c7f028fe5422b57b449a826a04929ea4869335fa
parent 264576 edabd5743aebba3bcdb7dbeab48f1538e38dcd4f
child 264578 b04c848c44af9b994be97d47c7c589218a7d6231
push id65677
push userktomlinson@mozilla.com
push dateSun, 27 Sep 2015 21:02:16 +0000
treeherdermozilla-inbound@c7f028fe5422 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1208327
milestone44.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 1208327 make enum AudioContextOperation strongly typed and forward declare instead of including AudioContext.h r=roc AudioContext.h is now exported only under mozilla.dom.
dom/media/GraphDriver.h
dom/media/MediaStreamGraph.cpp
dom/media/MediaStreamGraph.h
dom/media/webaudio/AudioContext.h
dom/media/webaudio/moz.build
--- a/dom/media/GraphDriver.h
+++ b/dom/media/GraphDriver.h
@@ -8,17 +8,16 @@
 
 #include "nsAutoPtr.h"
 #include "nsAutoRef.h"
 #include "AudioBufferUtils.h"
 #include "AudioMixer.h"
 #include "AudioSegment.h"
 #include "SelfRef.h"
 #include "mozilla/Atomics.h"
-#include "AudioContext.h"
 
 struct cubeb_stream;
 
 template <>
 class nsAutoRefTraits<cubeb_stream> : public nsPointerRefTraits<cubeb_stream>
 {
 public:
   static void Release(cubeb_stream* aStream) { cubeb_stream_destroy(aStream); }
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -2906,19 +2906,25 @@ MediaStreamGraphImpl::AudioContextOperat
 {
   // This can be called from the thread created to do cubeb operation, or the
   // MSG thread. The pointers passed back here are refcounted, so are still
   // alive.
   MonitorAutoLock lock(mMonitor);
 
   AudioContextState state;
   switch (aOperation) {
-    case Suspend: state = AudioContextState::Suspended; break;
-    case Resume: state = AudioContextState::Running; break;
-    case Close: state = AudioContextState::Closed; break;
+    case AudioContextOperation::Suspend:
+      state = AudioContextState::Suspended;
+      break;
+    case AudioContextOperation::Resume:
+      state = AudioContextState::Running;
+      break;
+    case AudioContextOperation::Close:
+      state = AudioContextState::Closed;
+      break;
     default: MOZ_CRASH("Not handled.");
   }
 
   nsCOMPtr<nsIRunnable> event = new dom::StateChangeTask(
       aStream->AsAudioNodeStream(), aPromise, state);
   NS_DispatchToMainThread(event.forget());
 }
 
--- a/dom/media/MediaStreamGraph.h
+++ b/dom/media/MediaStreamGraph.h
@@ -18,31 +18,34 @@
 #include "nsIRunnable.h"
 #include "StreamBuffer.h"
 #include "VideoFrameContainer.h"
 #include "VideoSegment.h"
 #include "MainThreadUtils.h"
 #include "nsAutoRef.h"
 #include <speex/speex_resampler.h>
 #include "DOMMediaStream.h"
-#include "AudioContext.h"
 
 class nsIRunnable;
 
 template <>
 class nsAutoRefTraits<SpeexResamplerState> : public nsPointerRefTraits<SpeexResamplerState>
 {
   public:
   static void Release(SpeexResamplerState* aState) { speex_resampler_destroy(aState); }
 };
 
 namespace mozilla {
 
 extern PRLogModuleInfo* gMediaStreamGraphLog;
 
+namespace dom {
+  enum class AudioContextOperation;
+}
+
 /*
  * MediaStreamGraph is a framework for synchronized audio/video processing
  * and playback. It is designed to be used by other browser components such as
  * HTML media elements, media capture APIs, real-time media streaming APIs,
  * multitrack media APIs, and advanced audio APIs.
  *
  * The MediaStreamGraph uses a dedicated thread to process media --- the media
  * graph thread. This ensures that we can process media through the graph
--- a/dom/media/webaudio/AudioContext.h
+++ b/dom/media/webaudio/AudioContext.h
@@ -106,17 +106,17 @@ public:
 
 private:
   nsRefPtr<AudioContext> mAudioContext;
   void* mPromise;
   nsRefPtr<AudioNodeStream> mAudioNodeStream;
   AudioContextState mNewState;
 };
 
-enum AudioContextOperation { Suspend, Resume, Close };
+enum class AudioContextOperation { Suspend, Resume, Close };
 
 class AudioContext final : public DOMEventTargetHelper,
                            public nsIMemoryReporter
 {
   AudioContext(nsPIDOMWindow* aParentWindow,
                bool aIsOffline,
                AudioChannel aChannel,
                uint32_t aNumberOfChannels = 0,
--- a/dom/media/webaudio/moz.build
+++ b/dom/media/webaudio/moz.build
@@ -16,17 +16,16 @@ MOCHITEST_MANIFESTS += [
     'test/mochitest.ini',
 ]
 
 MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
 
 EXPORTS += [
     'AlignedTArray.h',
     'AudioBlock.h',
-    'AudioContext.h',
     'AudioEventTimeline.h',
     'AudioNodeEngine.h',
     'AudioNodeExternalInputStream.h',
     'AudioNodeStream.h',
     'AudioParamTimeline.h',
     'MediaBufferDecoder.h',
     'ThreeDPoint.h',
     'WebAudioUtils.h',