From 92886562bf28fff19b8b705f2031da93398644b8 Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Mon, 6 Feb 2012 13:51:33 -0500 Subject: [PATCH] Limit composition to every 15 ms, may want to try increasing this value --- gfx/layers/ipc/CompositorParent.cpp | 10 ++++++++-- gfx/layers/ipc/CompositorParent.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index b240465ead48..1a9e90d18c2b 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -132,9 +132,15 @@ CompositorParent::ScheduleComposition() return; } + TimeDuration delta = mozilla::TimeStamp::Now() - mLastCompose; + printf_stderr("Schedule composition\n"); mCurrentCompositeTask = NewRunnableMethod(this, &CompositorParent::Composite); - MessageLoop::current()->PostTask(FROM_HERE, mCurrentCompositeTask); + if (delta.ToMilliseconds() < 15) { + MessageLoop::current()->PostDelayedTask(FROM_HERE, mCurrentCompositeTask, 15 - delta.ToMilliseconds()); + } else { + MessageLoop::current()->PostTask(FROM_HERE, mCurrentCompositeTask); + } // Test code for async scrolling. #ifdef OMTC_TEST_ASYNC_SCROLLING @@ -177,8 +183,8 @@ CompositorParent::Composite() Layer* root = mLayerManager->GetRoot(); root->AsShadowLayer()->SetShadowTransform(worldTransform); - mLayerManager->EndEmptyTransaction(); + mLastCompose = mozilla::TimeStamp::Now(); } // Go down shadow layer tree, setting properties to match their non-shadow diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h index cd114c2d66f8..27b28a9a5182 100644 --- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -131,6 +131,7 @@ private: nsRefPtr mLayerManager; nsIWidget* mWidget; CancelableTask *mCurrentCompositeTask; + TimeStamp mLastCompose; bool mPaused; float mXScale;