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

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

Issue 2061273002: cc: Make BackToBackBeginFrameSource a SyntheticBeginFrameSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: syntheticbeginframesource: delete-DEBUG_FRAMES Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « cc/scheduler/begin_frame_source_unittest.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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 protected: 30 protected:
31 virtual ~DelayBasedTimeSourceClient() {} 31 virtual ~DelayBasedTimeSourceClient() {}
32 }; 32 };
33 33
34 // This timer implements a time source that achieves the specified interval 34 // This timer implements a time source that achieves the specified interval
35 // in face of millisecond-precision delayed callbacks and random queueing 35 // in face of millisecond-precision delayed callbacks and random queueing
36 // delays. DelayBasedTimeSource uses base::TimeTicks::Now as its timebase. 36 // delays. DelayBasedTimeSource uses base::TimeTicks::Now as its timebase.
37 class CC_EXPORT DelayBasedTimeSource { 37 class CC_EXPORT DelayBasedTimeSource {
38 public: 38 public:
39 static std::unique_ptr<DelayBasedTimeSource> Create( 39 explicit DelayBasedTimeSource(base::SingleThreadTaskRunner* task_runner);
40 base::TimeDelta interval,
41 base::SingleThreadTaskRunner* task_runner) {
42 return base::WrapUnique(new DelayBasedTimeSource(interval, task_runner));
43 }
44
45 virtual ~DelayBasedTimeSource(); 40 virtual ~DelayBasedTimeSource();
46 41
47 void SetClient(DelayBasedTimeSourceClient* client); 42 void SetClient(DelayBasedTimeSourceClient* client);
48 43
49 void SetTimebaseAndInterval(base::TimeTicks timebase, 44 void SetTimebaseAndInterval(base::TimeTicks timebase,
50 base::TimeDelta interval); 45 base::TimeDelta interval);
51 46
52 base::TimeDelta Interval() const; 47 base::TimeDelta Interval() const;
53 48
54 void SetActive(bool active); 49 void SetActive(bool active);
55 bool Active() const; 50 bool Active() const;
56 51
57 // Get the last and next tick times. NextTickTime() returns null when 52 // Get the last and next tick times. NextTickTime() returns null when
58 // inactive. 53 // inactive.
59 base::TimeTicks LastTickTime() const; 54 base::TimeTicks LastTickTime() const;
60 base::TimeTicks NextTickTime() const; 55 base::TimeTicks NextTickTime() const;
61 56
62 virtual void AsValueInto(base::trace_event::TracedValue* dict) const; 57 virtual void AsValueInto(base::trace_event::TracedValue* dict) const;
63 58
64 protected: 59 protected:
65 DelayBasedTimeSource(base::TimeDelta interval,
66 base::SingleThreadTaskRunner* task_runner);
67
68 // Virtual for testing. 60 // Virtual for testing.
69 virtual base::TimeTicks Now() const; 61 virtual base::TimeTicks Now() const;
70 virtual std::string TypeString() const; 62 virtual std::string TypeString() const;
71 63
72 private: 64 private:
73 void PostNextTickTask(base::TimeTicks now); 65 void PostNextTickTask(base::TimeTicks now);
74 void ResetTickTask(base::TimeTicks now); 66 void ResetTickTask(base::TimeTicks now);
75 67
76 void OnTimerTick(); 68 void OnTimerTick();
77 69
(...skipping 12 matching lines...) Expand all
90 base::SingleThreadTaskRunner* task_runner_; 82 base::SingleThreadTaskRunner* task_runner_;
91 83
92 base::WeakPtrFactory<DelayBasedTimeSource> weak_factory_; 84 base::WeakPtrFactory<DelayBasedTimeSource> weak_factory_;
93 85
94 DISALLOW_COPY_AND_ASSIGN(DelayBasedTimeSource); 86 DISALLOW_COPY_AND_ASSIGN(DelayBasedTimeSource);
95 }; 87 };
96 88
97 } // namespace cc 89 } // namespace cc
98 90
99 #endif // CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_ 91 #endif // CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_
OLDNEW
« no previous file with comments | « cc/scheduler/begin_frame_source_unittest.cc ('k') | cc/scheduler/delay_based_time_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698