Bug 1413098 - Part 4 - Rename variable and reorder argument to remove default argument value. r=pehrsons draft
authorPaul Adenot <paul@paul.cx>
Mon, 26 Feb 2018 15:02:45 +0100
changeset 803531 a12632d384ce175b34b8ba987ca49ec96fbb7a1f
parent 803530 394c73e9385d51dd891a230b648eec1992850044
child 803532 927d9d0ca04dd593d49efdffe70ce9f70ddce8bd
push id112134
push userpaul@paul.cx
push dateMon, 04 Jun 2018 13:38:42 +0000
reviewerspehrsons
bugs1413098
milestone62.0a1
Bug 1413098 - Part 4 - Rename variable and reorder argument to remove default argument value. r=pehrsons MozReview-Commit-ID: CGrHExujtZ1
dom/media/webaudio/AudioContext.cpp
dom/media/webaudio/AudioDestinationNode.cpp
dom/media/webaudio/AudioDestinationNode.h
--- a/dom/media/webaudio/AudioContext.cpp
+++ b/dom/media/webaudio/AudioContext.cpp
@@ -148,31 +148,32 @@ AudioContext::AudioContext(nsPIDOMWindow
   , mCloseCalled(false)
   , mSuspendCalled(false)
   , mIsDisconnecting(false)
 {
   bool mute = aWindow->AddAudioContext(this);
 
   // Note: AudioDestinationNode needs an AudioContext that must already be
   // bound to the window.
-  bool allowToStart = AutoplayPolicy::IsAudioContextAllowedToPlay(WrapNotNull(this));
-  mDestination = new AudioDestinationNode(this, aIsOffline,
+  bool allowedToStart = AutoplayPolicy::IsAudioContextAllowedToPlay(WrapNotNull(this));
+  mDestination = new AudioDestinationNode(this,
+                                          aIsOffline,
+                                          allowedToStart,
                                           aNumberOfChannels,
                                           aLength,
-                                          aSampleRate,
-                                          allowToStart);
+                                          aSampleRate);
 
   // The context can't be muted until it has a destination.
   if (mute) {
     Mute();
   }
 
   // If we won't allow audio context to start, we need to suspend all its stream
   // in order to delay the state changing from 'suspend' to 'start'.
-  if (!allowToStart) {
+  if (!allowedToStart) {
     ErrorResult rv;
     RefPtr<Promise> dummy = Suspend(rv);
     MOZ_ASSERT(!rv.Failed(), "can't create promise");
     MOZ_ASSERT(dummy->State() != Promise::PromiseState::Rejected,
                "suspend failed");
   }
 }
 
--- a/dom/media/webaudio/AudioDestinationNode.cpp
+++ b/dom/media/webaudio/AudioDestinationNode.cpp
@@ -318,20 +318,20 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
   NS_INTERFACE_MAP_ENTRY(nsIAudioChannelAgentCallback)
 NS_INTERFACE_MAP_END_INHERITING(AudioNode)
 
 NS_IMPL_ADDREF_INHERITED(AudioDestinationNode, AudioNode)
 NS_IMPL_RELEASE_INHERITED(AudioDestinationNode, AudioNode)
 
 AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
                                            bool aIsOffline,
+                                           bool aAllowedToStart,
                                            uint32_t aNumberOfChannels,
                                            uint32_t aLength,
-                                           float aSampleRate,
-                                           bool aAllowToStart)
+                                           float aSampleRate)
   : AudioNode(aContext, aNumberOfChannels,
               ChannelCountMode::Explicit, ChannelInterpretation::Speakers)
   , mFramesToProduce(aLength)
   , mIsOffline(aIsOffline)
   , mAudioChannelSuspended(false)
   , mCaptured(false)
   , mAudible(AudioChannelService::AudibleState::eAudible)
 {
@@ -349,17 +349,17 @@ AudioDestinationNode::AudioDestinationNo
   AudioNodeStream::Flags flags =
     AudioNodeStream::NEED_MAIN_THREAD_CURRENT_TIME |
     AudioNodeStream::NEED_MAIN_THREAD_FINISHED |
     AudioNodeStream::EXTERNAL_OUTPUT;
   mStream = AudioNodeStream::Create(aContext, engine, flags, graph);
   mStream->AddMainThreadListener(this);
   mStream->AddAudioOutput(&gWebAudioOutputKey);
 
-  if (!aIsOffline && aAllowToStart) {
+  if (!aIsOffline && aAllowedToStart) {
     graph->NotifyWhenGraphStarted(mStream);
   }
 }
 
 AudioDestinationNode::~AudioDestinationNode()
 {
 }
 
--- a/dom/media/webaudio/AudioDestinationNode.h
+++ b/dom/media/webaudio/AudioDestinationNode.h
@@ -20,20 +20,20 @@ class AudioDestinationNode final : publi
                                  , public nsIAudioChannelAgentCallback
                                  , public MainThreadMediaStreamListener
 {
 public:
   // This node type knows what MediaStreamGraph to use based on
   // whether it's in offline mode.
   AudioDestinationNode(AudioContext* aContext,
                        bool aIsOffline,
+                       bool aAllowedToStart,
                        uint32_t aNumberOfChannels = 0,
                        uint32_t aLength = 0,
-                       float aSampleRate = 0.0f,
-                       bool aAllowToStart = true);
+                       float aSampleRate = 0.0f);
 
   void DestroyMediaStream() override;
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AudioDestinationNode, AudioNode)
   NS_DECL_NSIAUDIOCHANNELAGENTCALLBACK
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;