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

Unified Diff: cc/delay_based_time_source.h

Issue 11122003: [cc] Rename all cc/ filenames to Chromium style (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/debug_rect_history.cc ('k') | cc/delay_based_time_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/delay_based_time_source.h
diff --git a/cc/delay_based_time_source.h b/cc/delay_based_time_source.h
index 638cbb270ce9b24689d5095baf174ade4f4d1a13..bf183f7aa7313e2ffd2131829f77e6a7d83b773a 100644
--- a/cc/delay_based_time_source.h
+++ b/cc/delay_based_time_source.h
@@ -1,3 +1,79 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCDelayBasedTimeSource_h
+#define CCDelayBasedTimeSource_h
+
+#include "CCTimeSource.h"
+#include "CCTimer.h"
+#include <wtf/PassRefPtr.h>
+
+namespace cc {
+
+class CCThread;
+
+// This timer implements a time source that achieves the specified interval
+// in face of millisecond-precision delayed callbacks and random queueing delays.
+class CCDelayBasedTimeSource : public CCTimeSource, CCTimerClient {
+public:
+ static PassRefPtr<CCDelayBasedTimeSource> create(base::TimeDelta interval, CCThread*);
+
+ virtual ~CCDelayBasedTimeSource();
+
+ virtual void setClient(CCTimeSourceClient* client) OVERRIDE;
+
+ // CCTimeSource implementation
+ virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE;
+
+ virtual void setActive(bool) OVERRIDE;
+ virtual bool active() const OVERRIDE;
+
+ // Get the last and next tick times. nextTimeTime() returns null when
+ // inactive.
+ virtual base::TimeTicks lastTickTime() OVERRIDE;
+ virtual base::TimeTicks nextTickTime() OVERRIDE;
+
+ // CCTimerClient implementation.
+ virtual void onTimerFired() OVERRIDE;
+
+ // Virtual for testing.
+ virtual base::TimeTicks now() const;
+
+protected:
+ CCDelayBasedTimeSource(base::TimeDelta interval, CCThread*);
+ base::TimeTicks nextTickTarget(base::TimeTicks now);
+ void postNextTickTask(base::TimeTicks now);
+
+ enum State {
+ STATE_INACTIVE,
+ STATE_STARTING,
+ STATE_ACTIVE,
+ };
+
+ struct Parameters {
+ Parameters(base::TimeDelta interval, base::TimeTicks tickTarget)
+ : interval(interval), tickTarget(tickTarget)
+ { }
+ base::TimeDelta interval;
+ base::TimeTicks tickTarget;
+ };
+
+ CCTimeSourceClient* m_client;
+ bool m_hasTickTarget;
+ base::TimeTicks m_lastTickTime;
+
+ // m_currentParameters should only be written by postNextTickTask.
+ // m_nextParameters will take effect on the next call to postNextTickTask.
+ // Maintaining a pending set of parameters allows nextTickTime() to always
+ // reflect the actual time we expect onTimerFired to be called.
+ Parameters m_currentParameters;
+ Parameters m_nextParameters;
+
+ State m_state;
+ CCThread* m_thread;
+ CCTimer m_timer;
+};
+
+}
+#endif // CCDelayBasedTimeSource_h
« no previous file with comments | « cc/debug_rect_history.cc ('k') | cc/delay_based_time_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698