Bug 1159558 - Eliminate initial notifies. r=jww
authorBobby Holley <bobbyholley@gmail.com>
Tue, 28 Apr 2015 19:00:14 -0700
changeset 273290 d27e5cc67ddafa6c26311a7156068b3c6615648c
parent 273289 e1d007ba632148d6f6b6d3add504481f87598ac6
child 273291 e70d42de84381f59a9648e24490b689c6cbb95a5
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjww
bugs1159558
milestone40.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 1159558 - Eliminate initial notifies. r=jww They've proven themselves to be a hassle, and I think we can live without them.
dom/media/MediaDecoderStateMachine.cpp
dom/media/StateWatching.h
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -262,18 +262,18 @@ MediaDecoderStateMachine::MediaDecoderSt
   // Initialize mirrors.
   mPlayState.Init(mTaskQueue, MediaDecoder::PLAY_STATE_LOADING, "MediaDecoderStateMachine::mPlayState (Mirror)",
                   aDecoder->CanonicalPlayState());
   mNextPlayState.Init(mTaskQueue, MediaDecoder::PLAY_STATE_PAUSED, "MediaDecoderStateMachine::mNextPlayState (Mirror)",
                   aDecoder->CanonicalNextPlayState());
 
   // Skip the initial notification we get when we Watch the value, since we're
   // not on the right thread yet.
-  mNextFrameStatusUpdater->Watch(mState, /* aSkipInitialNotify = */ true);
-  mNextFrameStatusUpdater->Watch(mAudioCompleted, /* aSkipInitialNotify = */ true);
+  mNextFrameStatusUpdater->Watch(mState);
+  mNextFrameStatusUpdater->Watch(mAudioCompleted);
   mNextFrameStatusUpdater->AddWeakCallback(this, &MediaDecoderStateMachine::UpdateNextFrameStatus);
 
   static bool sPrefCacheInit = false;
   if (!sPrefCacheInit) {
     sPrefCacheInit = true;
     Preferences::AddUintVarCache(&sVideoQueueDefaultSize,
                                  "media.video-queue.default-size",
                                  MAX_VIDEO_QUEUE_SIZE);
--- a/dom/media/StateWatching.h
+++ b/dom/media/StateWatching.h
@@ -99,23 +99,20 @@ private:
  * The functionality that this class provides is not threadsafe, and should only
  * be used on the thread that owns that WatchTarget.
  */
 class WatchTarget
 {
 public:
   explicit WatchTarget(const char* aName) : mName(aName) {}
 
-  void AddWatcher(AbstractWatcher* aWatcher, bool aSkipInitialNotify)
+  void AddWatcher(AbstractWatcher* aWatcher)
   {
     MOZ_ASSERT(!mWatchers.Contains(aWatcher));
     mWatchers.AppendElement(aWatcher);
-    if (!aSkipInitialNotify) {
-      aWatcher->Notify();
-    }
   }
 
   void RemoveWatcher(AbstractWatcher* aWatcher)
   {
     MOZ_ASSERT(mWatchers.Contains(aWatcher));
     mWatchers.RemoveElement(aWatcher);
   }
 
@@ -201,17 +198,17 @@ public:
     }
     mNotifying = true;
 
     // Queue up our notification jobs to run in a stable state.
     nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(this, &Watcher::DoNotify);
     AbstractThread::GetCurrent()->TailDispatcher().AddDirectTask(r.forget());
   }
 
-  void Watch(WatchTarget& aTarget, bool aSkipInitialNotify = false) { aTarget.AddWatcher(this, aSkipInitialNotify); }
+  void Watch(WatchTarget& aTarget) { aTarget.AddWatcher(this); }
   void Unwatch(WatchTarget& aTarget) { aTarget.RemoveWatcher(this); }
 
   template<typename ThisType>
   void AddWeakCallback(ThisType* aThisVal, void(ThisType::*aMethod)())
   {
     mCallbacks.AppendElement(NS_NewNonOwningRunnableMethod(aThisVal, aMethod));
   }