Bug 927349 part 10 - Record the time when animations are ready to start; r=jwatt
authorBrian Birtles <birtles@gmail.com>
Mon, 22 Dec 2014 09:35:41 +0900
changeset 220794 7df2255ce1e2b9e52cac824b7adf58649dae8067
parent 220793 f77e3d03e7e3444e07ebd17a2c8ed48d01dfb7f5
child 220795 4b9b9370d2e101c302b6ff3f1e537c17aada1e2b
push id53192
push userbbirtles@mozilla.com
push dateMon, 22 Dec 2014 00:36:19 +0000
treeherdermozilla-inbound@c7aaf7025e59 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs927349
milestone37.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 927349 part 10 - Record the time when animations are ready to start; r=jwatt
gfx/layers/Layers.h
gfx/layers/basic/BasicLayerManager.cpp
gfx/layers/client/ClientLayerManager.cpp
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -665,16 +665,20 @@ public:
   bool SupportsMixBlendMode(gfx::CompositionOp aMixBlendMode)
   {
     EnumSet<gfx::CompositionOp> modes(aMixBlendMode);
     return SupportsMixBlendModes(modes);
   }
 
   virtual float RequestProperty(const nsAString& property) { return -1; }
 
+  const TimeStamp& GetAnimationReadyTime() const {
+    return mAnimationReadyTime;
+  }
+
 protected:
   nsRefPtr<Layer> mRoot;
   gfx::UserData mUserData;
   bool mDestroyed;
   bool mSnapEffectiveTransforms;
 
   nsIntRegion mRegionToClear;
 
@@ -688,16 +692,19 @@ protected:
   // Print interesting information about this into layerscope packet.
   // Internally used to implement Dump().
   virtual void DumpPacket(layerscope::LayersPacket* aPacket);
 
   static void InitLog();
   static PRLogModuleInfo* sLog;
   uint64_t mId;
   bool mInTransaction;
+  // The time when painting most recently finished. This is recorded so that
+  // we can time any play-pending animations from this point.
+  TimeStamp mAnimationReadyTime;
 private:
   struct FramesTimingRecording
   {
     // Stores state and data for frame intervals and paint times recording.
     // see LayerManager::StartFrameTimeRecording() at Layers.cpp for more details.
     FramesTimingRecording()
       : mIsPaused(true)
       , mNextIndex(0)
--- a/gfx/layers/basic/BasicLayerManager.cpp
+++ b/gfx/layers/basic/BasicLayerManager.cpp
@@ -540,16 +540,20 @@ BasicLayerManager::EndTransactionInterna
     PostPresent();
 
     if (!mTransactionIncomplete) {
       // Clear out target if we have a complete transaction.
       mTarget = nullptr;
     }
   }
 
+  if (mRoot) {
+    mAnimationReadyTime = TimeStamp::Now();
+  }
+
 #ifdef MOZ_LAYERS_HAVE_LOG
   Log();
   MOZ_LAYERS_LOG(("]----- EndTransaction"));
 #endif
 
   // Go back to the construction phase if the transaction isn't complete.
   // Layout will update the layer tree and call EndTransaction().
   mPhase = mTransactionIncomplete ? PHASE_CONSTRUCTION : PHASE_NONE;
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -264,17 +264,21 @@ ClientLayerManager::EndTransactionIntern
   mPaintedLayerCallbackData = aCallbackData;
 
   GetRoot()->ComputeEffectiveTransforms(Matrix4x4());
 
   root->RenderLayer();
   if (!mRepeatTransaction && !GetRoot()->GetInvalidRegion().IsEmpty()) {
     GetRoot()->Mutated();
   }
-  
+
+  if (!mIsRepeatTransaction) {
+    mAnimationReadyTime = TimeStamp::Now();
+  }
+
   mPaintedLayerCallback = nullptr;
   mPaintedLayerCallbackData = nullptr;
 
   // Go back to the construction phase if the transaction isn't complete.
   // Layout will update the layer tree and call EndTransaction().
   mPhase = mTransactionIncomplete ? PHASE_CONSTRUCTION : PHASE_NONE;
 
   NS_ASSERTION(!aCallback || !mTransactionIncomplete,