| 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();
|
| }
|
|
|