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

Unified Diff: cc/delay_based_time_source.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/delay_based_time_source.h ('k') | cc/frame_rate_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/delay_based_time_source.cc
diff --git a/cc/delay_based_time_source.cc b/cc/delay_based_time_source.cc
index d2334105f264d4323a5d8d6c98dafe286aa09932..0beb72b3130f9a96c22c2f7d39445ae53d028f7f 100644
--- a/cc/delay_based_time_source.cc
+++ b/cc/delay_based_time_source.cc
@@ -11,6 +11,8 @@
#include "base/debug/trace_event.h"
#include "base/logging.h"
+#include "base/message_loop.h"
+#include "cc/thread.h"
namespace cc {
@@ -40,7 +42,8 @@ DelayBasedTimeSource::DelayBasedTimeSource(base::TimeDelta interval, Thread* thr
, m_currentParameters(interval, base::TimeTicks())
, m_nextParameters(interval, base::TimeTicks())
, m_state(STATE_INACTIVE)
- , m_timer(thread, this)
+ , m_thread(thread)
+ , m_weakFactory(ALLOW_THIS_IN_INITIALIZER_LIST(this))
{
}
@@ -53,7 +56,7 @@ void DelayBasedTimeSource::setActive(bool active)
TRACE_EVENT1("cc", "DelayBasedTimeSource::setActive", "active", active);
if (!active) {
m_state = STATE_INACTIVE;
- m_timer.stop();
+ m_weakFactory.InvalidateWeakPtrs();
return;
}
@@ -65,7 +68,7 @@ void DelayBasedTimeSource::setActive(bool active)
// it runs, we use that to establish the timebase, become truly active, and
// fire the first tick.
m_state = STATE_STARTING;
- m_timer.startOneShot(0);
+ m_thread->postTask(base::Bind(&DelayBasedTimeSource::onTimerFired, m_weakFactory.GetWeakPtr()));
return;
}
@@ -222,7 +225,9 @@ void DelayBasedTimeSource::postNextTickTask(base::TimeTicks now)
base::TimeDelta delay = newTickTarget - now;
DCHECK(delay.InMillisecondsF() <=
m_nextParameters.interval.InMillisecondsF() * (1.0 + doubleTickThreshold));
- m_timer.startOneShot(delay.InSecondsF());
+ m_thread->postDelayedTask(base::Bind(&DelayBasedTimeSource::onTimerFired,
+ m_weakFactory.GetWeakPtr()),
+ delay.InMilliseconds());
m_nextParameters.tickTarget = newTickTarget;
m_currentParameters = m_nextParameters;
« no previous file with comments | « cc/delay_based_time_source.h ('k') | cc/frame_rate_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698