Bug 825809 - mWaitingForContentToPaint should be true after mPaintThrottler.TaskComplete post new task. r=ajones
authorOleg Romashin <romaxa@gmail.com>
Thu, 03 Jan 2013 11:58:15 -0800
changeset 126585 97d2ac9d16c48485218c0f960c461d9cbd1b2bb2
parent 126584 8dd151b3ce40d21b9675edee1c150fb0c5f2e64d
child 126586 ecd2331e67980cd52f5c20cbd53fedab0e6606d4
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersajones
bugs825809
milestone20.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 825809 - mWaitingForContentToPaint should be true after mPaintThrottler.TaskComplete post new task. r=ajones
gfx/layers/ipc/AsyncPanZoomController.cpp
gfx/layers/ipc/TaskThrottler.cpp
gfx/layers/ipc/TaskThrottler.h
--- a/gfx/layers/ipc/AsyncPanZoomController.cpp
+++ b/gfx/layers/ipc/AsyncPanZoomController.cpp
@@ -1123,18 +1123,16 @@ bool AsyncPanZoomController::SampleConte
   mLastSampleTime = aSampleTime;
 
   return requestAnimationFrame;
 }
 
 void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aViewportFrame, bool aIsFirstPaint) {
   MonitorAutoLock monitor(mMonitor);
 
-  mPaintThrottler.TaskComplete();
-
   mLastContentPaintMetrics = aViewportFrame;
 
   if (mWaitingForContentToPaint) {
     // Remove the oldest sample we have if adding a new sample takes us over our
     // desired number of samples.
     if (mPreviousPaintDurations.Length() >= NUM_PAINT_DURATION_SAMPLES) {
       mPreviousPaintDurations.RemoveElementAt(0);
     }
@@ -1156,17 +1154,17 @@ void AsyncPanZoomController::NotifyLayer
       mFrameMetrics.mScrollOffset = aViewportFrame.mScrollOffset;
       break;
     // Don't clobber if we're in other states.
     default:
       break;
     }
   }
 
-  mWaitingForContentToPaint = false;
+  mWaitingForContentToPaint = mPaintThrottler.TaskComplete();
   bool needContentRepaint = false;
   if (aViewportFrame.mCompositionBounds.width == mFrameMetrics.mCompositionBounds.width &&
       aViewportFrame.mCompositionBounds.height == mFrameMetrics.mCompositionBounds.height) {
     // Remote content has sync'd up to the composition geometry
     // change, so we can accept the viewport it's calculated.
     gfxSize previousResolution = CalculateResolution(mFrameMetrics);
     mFrameMetrics.mViewport = aViewportFrame.mViewport;
     gfxSize newResolution = CalculateResolution(mFrameMetrics);
--- a/gfx/layers/ipc/TaskThrottler.cpp
+++ b/gfx/layers/ipc/TaskThrottler.cpp
@@ -29,21 +29,22 @@ TaskThrottler::PostTask(const tracked_ob
     mQueuedTask = aTask;
   } else {
     aTask->Run();
     delete aTask;
     mOutstanding = true;
   }
 }
 
-void
+bool
 TaskThrottler::TaskComplete()
 {
   if (mQueuedTask) {
     mQueuedTask->Run();
     mQueuedTask = nullptr;
-  } else {
-    mOutstanding = false;
+    return true;
   }
+  mOutstanding = false;
+  return false;
 }
 
 }
 }
--- a/gfx/layers/ipc/TaskThrottler.h
+++ b/gfx/layers/ipc/TaskThrottler.h
@@ -38,17 +38,20 @@ public:
    *
    * @param aLocation Use the macro FROM_HERE
    * @param aTask     Ownership of this object is transferred to TaskThrottler
    *                  which will delete it when it is either run or becomes
    *                  obsolete or the TaskThrottler is destructed.
    */
   void PostTask(const tracked_objects::Location& aLocation,
                 CancelableTask* aTask);
-  void TaskComplete();
+  /**
+   * return true if Throttler had outstanding task
+   */
+  bool TaskComplete();
 
 private:
   bool mOutstanding;
   nsAutoPtr<CancelableTask> mQueuedTask;
 };
 
 }
 }