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

Side by Side Diff: cc/scheduler/delay_based_time_source.h

Issue 27710005: cc: Use HighResNow as timebase if it is fast and reliable (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix DCHECK Created 7 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « cc/resources/resource_update_controller.cc ('k') | cc/scheduler/delay_based_time_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_ 5 #ifndef CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_
6 #define CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_ 6 #define CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "cc/base/cc_export.h" 9 #include "cc/base/cc_export.h"
10 #include "cc/scheduler/time_source.h" 10 #include "cc/scheduler/time_source.h"
11 11
12 namespace base { class SingleThreadTaskRunner; } 12 namespace base { class SingleThreadTaskRunner; }
13 13
14 namespace cc { 14 namespace cc {
15 15
16 // This timer implements a time source that achieves the specified interval 16 // This timer implements a time source that achieves the specified interval
17 // in face of millisecond-precision delayed callbacks and random queueing 17 // in face of millisecond-precision delayed callbacks and random queueing
18 // delays. 18 // delays. DelayBasedTimeSource uses base::TimeTicks::Now as its timebase.
19 class CC_EXPORT DelayBasedTimeSource : public TimeSource { 19 class CC_EXPORT DelayBasedTimeSource : public TimeSource {
20 public: 20 public:
21 static scoped_refptr<DelayBasedTimeSource> Create( 21 static scoped_refptr<DelayBasedTimeSource> Create(
22 base::TimeDelta interval, base::SingleThreadTaskRunner* task_runner); 22 base::TimeDelta interval, base::SingleThreadTaskRunner* task_runner);
23 23
24 virtual void SetClient(TimeSourceClient* client) OVERRIDE; 24 virtual void SetClient(TimeSourceClient* client) OVERRIDE;
25 25
26 // TimeSource implementation 26 // TimeSource implementation
27 virtual void SetTimebaseAndInterval(base::TimeTicks timebase, 27 virtual void SetTimebaseAndInterval(base::TimeTicks timebase,
28 base::TimeDelta interval) OVERRIDE; 28 base::TimeDelta interval) OVERRIDE;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 bool active_; 67 bool active_;
68 68
69 base::SingleThreadTaskRunner* task_runner_; 69 base::SingleThreadTaskRunner* task_runner_;
70 base::WeakPtrFactory<DelayBasedTimeSource> weak_factory_; 70 base::WeakPtrFactory<DelayBasedTimeSource> weak_factory_;
71 71
72 private: 72 private:
73 DISALLOW_COPY_AND_ASSIGN(DelayBasedTimeSource); 73 DISALLOW_COPY_AND_ASSIGN(DelayBasedTimeSource);
74 }; 74 };
75 75
76 // DelayBasedTimeSource uses base::TimeTicks::HighResNow as its timebase.
77 class DelayBasedTimeSourceHighRes : public DelayBasedTimeSource {
78 public:
79 static scoped_refptr<DelayBasedTimeSourceHighRes> Create(
80 base::TimeDelta interval, base::SingleThreadTaskRunner* task_runner);
81
82 virtual base::TimeTicks Now() const OVERRIDE;
83
84 protected:
85 DelayBasedTimeSourceHighRes(base::TimeDelta interval,
86 base::SingleThreadTaskRunner* task_runner);
87 virtual ~DelayBasedTimeSourceHighRes();
88
89 private:
90 DISALLOW_COPY_AND_ASSIGN(DelayBasedTimeSourceHighRes);
91 };
92
76 } // namespace cc 93 } // namespace cc
77 94
78 #endif // CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_ 95 #endif // CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_
OLDNEW
« no previous file with comments | « cc/resources/resource_update_controller.cc ('k') | cc/scheduler/delay_based_time_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698