Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1903)

Unified Diff: cc/frame_rate_controller.cc

Issue 11344004: Remove WebKit::Platform dependencies from cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix webkit_compositor_bindings_unittests Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/frame_rate_controller.h ('k') | cc/gl_renderer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/frame_rate_controller.cc
diff --git a/cc/frame_rate_controller.cc b/cc/frame_rate_controller.cc
index 46000fc19552067364546c0a06994e8962407235..97e4a02ea9f91e86be7e72d53532eafbe897464b 100644
--- a/cc/frame_rate_controller.cc
+++ b/cc/frame_rate_controller.cc
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "cc/delay_based_time_source.h"
#include "cc/time_source.h"
+#include "cc/thread.h"
namespace {
@@ -47,6 +48,8 @@ FrameRateController::FrameRateController(scoped_refptr<TimeSource> timer)
, m_active(false)
, m_swapBuffersCompleteSupported(true)
, m_isTimeSourceThrottling(true)
+ , m_thread(0)
+ , m_weakFactory(ALLOW_THIS_IN_INITIALIZER_LIST(this))
{
m_timeSourceClientAdapter = FrameRateControllerTimeSourceAdapter::create(this);
m_timeSource->setClient(m_timeSourceClientAdapter.get());
@@ -59,7 +62,8 @@ FrameRateController::FrameRateController(Thread* thread)
, m_active(false)
, m_swapBuffersCompleteSupported(true)
, m_isTimeSourceThrottling(false)
- , m_manualTicker(new Timer(thread, this))
+ , m_thread(thread)
+ , m_weakFactory(ALLOW_THIS_IN_INITIALIZER_LIST(this))
{
}
@@ -82,7 +86,7 @@ void FrameRateController::setActive(bool active)
if (active)
postManualTick();
else
- m_manualTicker->stop();
+ m_weakFactory.InvalidateWeakPtrs();
}
}
@@ -120,10 +124,10 @@ void FrameRateController::onTimerTick()
void FrameRateController::postManualTick()
{
if (m_active)
- m_manualTicker->startOneShot(0);
+ m_thread->postTask(base::Bind(&FrameRateController::manualTick, m_weakFactory.GetWeakPtr()));
}
-void FrameRateController::onTimerFired()
+void FrameRateController::manualTick()
{
onTimerTick();
}
« no previous file with comments | « cc/frame_rate_controller.h ('k') | cc/gl_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698