Bug 825556 - RequestContentRepaint frequency should be possible to limit with some timeout. r=drs
authorOleg Romashin <romaxa@gmail.com>
Fri, 04 Jan 2013 19:24:15 -0800
changeset 117684 bd3b4d20072a3cd9b040ecfca0d5a9217c1cc59e
parent 117683 dc3d10cccb8681f6b34fed79d9a864a5bccbd4fb
child 117685 20df426b611197b3fdf08615f2b2f951b9ebf282
push id20647
push userromaxa@gmail.com
push dateSat, 05 Jan 2013 03:33:52 +0000
treeherdermozilla-inbound@bd3b4d20072a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrs
bugs825556
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 825556 - RequestContentRepaint frequency should be possible to limit with some timeout. r=drs
gfx/layers/ipc/AsyncPanZoomController.cpp
--- a/gfx/layers/ipc/AsyncPanZoomController.cpp
+++ b/gfx/layers/ipc/AsyncPanZoomController.cpp
@@ -87,16 +87,17 @@ AsyncPanZoomController::AsyncPanZoomCont
      mX(this),
      mY(this),
      mAllowZoom(true),
      mMinZoom(MIN_ZOOM),
      mMaxZoom(MAX_ZOOM),
      mMonitor("AsyncPanZoomController"),
      mLastSampleTime(TimeStamp::Now()),
      mState(NOTHING),
+     mPreviousPaintStartTime(TimeStamp::Now()),
      mLastAsyncScrollTime(TimeStamp::Now()),
      mLastAsyncScrollOffset(0, 0),
      mCurrentAsyncScrollOffset(0, 0),
      mAsyncScrollTimeoutTask(nullptr),
      mAsyncScrollThrottleTime(100),
      mAsyncScrollTimeout(300),
      mDPI(72),
      mWaitingForContentToPaint(false),
@@ -669,17 +670,20 @@ void AsyncPanZoomController::TrackTouch(
                                                           timeDelta);
     if (!xDisplacement && !yDisplacement) {
       return;
     }
 
     ScrollBy(gfx::Point(xDisplacement, yDisplacement));
     ScheduleComposite();
 
-    RequestContentRepaint();
+    TimeDuration timePaintDelta = TimeStamp::Now() - mPreviousPaintStartTime;
+    if (timePaintDelta.ToMilliseconds() > PAN_REPAINT_INTERVAL) {
+      RequestContentRepaint();
+    }
   }
 }
 
 SingleTouchData& AsyncPanZoomController::GetFirstSingleTouch(const MultiTouchInput& aEvent) {
   return (SingleTouchData&)aEvent.mTouches[0];
 }
 
 bool AsyncPanZoomController::DoFling(const TimeDuration& aDelta) {
@@ -703,17 +707,20 @@ bool AsyncPanZoomController::DoFling(con
   // We want to inversely scale it because when you're zoomed further in, a
   // larger swipe should move you a shorter distance.
   gfxFloat inverseResolution = 1 / CalculateResolution(mFrameMetrics).width;
 
   ScrollBy(gfx::Point(
     mX.GetDisplacementForDuration(inverseResolution, aDelta),
     mY.GetDisplacementForDuration(inverseResolution, aDelta)
   ));
-  RequestContentRepaint();
+  TimeDuration timePaintDelta = TimeStamp::Now() - mPreviousPaintStartTime;
+  if (timePaintDelta.ToMilliseconds() > FLING_REPAINT_INTERVAL) {
+    RequestContentRepaint();
+  }
 
   return true;
 }
 
 void AsyncPanZoomController::CancelAnimation() {
   mState = NOTHING;
 }