Remove WebKit::Platform dependencies from cc
This removes all dependencies on the static WebKit::Platform pointer from cc.
The biggest change is implementing cc::Thread on top of base::MessageLoopProxy
instead of WebKit::WebThread. For the main thread cc::Thread simply binds to
the current thread's MessageLoopProxy. For the impl thread, the bindings layer
(specifically webkit/compositor_bindings/web_compositor_impl) extracts the
MessageLoopProxy out of the passed in WebThread.
BUG=144539
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=165050
Review URL: https://codereview.chromium.org/11344004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165060 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/delay_based_time_source.h b/cc/delay_based_time_source.h
index b2944bd..a9229c3 100644
--- a/cc/delay_based_time_source.h
+++ b/cc/delay_based_time_source.h
@@ -5,18 +5,16 @@
#ifndef CCDelayBasedTimeSource_h
#define CCDelayBasedTimeSource_h
+#include "base/memory/weak_ptr.h"
#include "cc/time_source.h"
-#include "cc/timer.h"
namespace cc {
-class Thread;
-
// This timer implements a time source that achieves the specified interval
// in face of millisecond-precision delayed callbacks and random queueing delays.
-class DelayBasedTimeSource : public TimeSource, TimerClient {
+class DelayBasedTimeSource : public TimeSource {
public:
- static scoped_refptr<DelayBasedTimeSource> create(base::TimeDelta interval, Thread*);
+ static scoped_refptr<DelayBasedTimeSource> create(base::TimeDelta interval, Thread* thread);
virtual void setClient(TimeSourceClient* client) OVERRIDE;
@@ -31,18 +29,17 @@
virtual base::TimeTicks lastTickTime() OVERRIDE;
virtual base::TimeTicks nextTickTime() OVERRIDE;
- // TimerClient implementation.
- virtual void onTimerFired() OVERRIDE;
// Virtual for testing.
virtual base::TimeTicks now() const;
protected:
- DelayBasedTimeSource(base::TimeDelta interval, Thread*);
+ DelayBasedTimeSource(base::TimeDelta interval, Thread* thread);
virtual ~DelayBasedTimeSource();
base::TimeTicks nextTickTarget(base::TimeTicks now);
void postNextTickTask(base::TimeTicks now);
+ void onTimerFired();
enum State {
STATE_INACTIVE,
@@ -70,8 +67,10 @@
Parameters m_nextParameters;
State m_state;
+
Thread* m_thread;
- Timer m_timer;
+ base::WeakPtrFactory<DelayBasedTimeSource> m_weakFactory;
+ DISALLOW_COPY_AND_ASSIGN(DelayBasedTimeSource);
};
} // namespace cc