Bug 1312321. Part 2 - make SetState() protected again. r=JamesCheng
authorJW Wang <jwwang@mozilla.com>
Mon, 24 Oct 2016 11:47:51 +0800
changeset 319272 bf7df2a398a4a1ccb4a3ed0335973c0bd012483f
parent 319271 b7fb1a72dd5cfe9342a6f5284da74502de1bea36
child 319273 fe1bae8e454ef0f6d98a07c58f7b28591d2e2f09
push id30869
push userphilringnalda@gmail.com
push dateWed, 26 Oct 2016 04:57:48 +0000
treeherdermozilla-central@9471b3c49b2c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJamesCheng
bugs1312321
milestone52.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 1312321. Part 2 - make SetState() protected again. r=JamesCheng MozReview-Commit-ID: BlYO8U28gVQ
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -224,21 +224,16 @@ public:
 protected:
   using Master = MediaDecoderStateMachine;
   explicit StateObject(Master* aPtr) : mMaster(aPtr) {}
   TaskQueue* OwnerThread() const { return mMaster->mTaskQueue; }
   MediaResource* Resource() const { return mMaster->mResource; }
   MediaDecoderReaderWrapper* Reader() const { return mMaster->mReader; }
   const MediaInfo& Info() const { return mMaster->Info(); }
 
-public:
-  // TODO: this function is public because VisibilityChanged() calls it.
-  // We should handle visibility changes in state objects so this function
-  // can be made protected again.
-  //
   // Note this function will delete the current state object.
   // Don't access members to avoid UAF after this call.
   template <class S, typename... Ts>
   auto SetState(Ts... aArgs)
     -> decltype(DeclVal<S>().Enter(Move(aArgs)...))
   {
     // keep mMaster in a local object because mMaster will become invalid after
     // the current state object is deleted.
@@ -253,17 +248,16 @@ public:
 
     Exit();
 
     master->mState = s->GetState();
     master->mStateObj.reset(s);
     return s->Enter(Move(aArgs)...);
   }
 
-protected:
   // Take a raw pointer in order not to change the life cycle of MDSM.
   // It is guaranteed to be valid by MDSM.
   Master* mMaster;
 };
 
 /**
  * Purpose: decode metadata like duration and dimensions of the media resource.
  *