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

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

Issue 628443002: replace OVERRIDE and FINAL with override and final in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_BEGIN_FRAME_SOURCE_H_ 5 #ifndef CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_
6 #define CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ 6 #define CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // function. 64 // function.
65 class CC_EXPORT BeginFrameObserverMixIn : public BeginFrameObserver { 65 class CC_EXPORT BeginFrameObserverMixIn : public BeginFrameObserver {
66 public: 66 public:
67 BeginFrameObserverMixIn(); 67 BeginFrameObserverMixIn();
68 68
69 // BeginFrameObserver 69 // BeginFrameObserver
70 70
71 // Traces |args| and DCHECK |args| satisfies pre-conditions then calls 71 // Traces |args| and DCHECK |args| satisfies pre-conditions then calls
72 // OnBeginFrameMixInDelegate and updates the last_begin_frame_args_ value on 72 // OnBeginFrameMixInDelegate and updates the last_begin_frame_args_ value on
73 // true. 73 // true.
74 virtual void OnBeginFrame(const BeginFrameArgs& args) OVERRIDE; 74 virtual void OnBeginFrame(const BeginFrameArgs& args) override;
75 virtual const BeginFrameArgs LastUsedBeginFrameArgs() const OVERRIDE; 75 virtual const BeginFrameArgs LastUsedBeginFrameArgs() const override;
76 76
77 // Outputs last_begin_frame_args_ 77 // Outputs last_begin_frame_args_
78 virtual void AsValueInto(base::debug::TracedValue* dict) const OVERRIDE; 78 virtual void AsValueInto(base::debug::TracedValue* dict) const override;
79 79
80 protected: 80 protected:
81 // Subclasses should override this method! 81 // Subclasses should override this method!
82 // Return true if the given argument is (or will be) used. 82 // Return true if the given argument is (or will be) used.
83 virtual bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) = 0; 83 virtual bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) = 0;
84 84
85 BeginFrameArgs last_begin_frame_args_; 85 BeginFrameArgs last_begin_frame_args_;
86 int64_t dropped_begin_frame_args_; 86 int64_t dropped_begin_frame_args_;
87 }; 87 };
88 88
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // - Implement the pure virtual (Set)NeedsBeginFrames methods from 127 // - Implement the pure virtual (Set)NeedsBeginFrames methods from
128 // BeginFrameSource. 128 // BeginFrameSource.
129 // - Use the CallOnBeginFrame method to call to the observer(s). 129 // - Use the CallOnBeginFrame method to call to the observer(s).
130 // - Recommended (but not required) to call BeginFrameSourceMixIn::AsValueInto 130 // - Recommended (but not required) to call BeginFrameSourceMixIn::AsValueInto
131 // in their own AsValueInto implementation. 131 // in their own AsValueInto implementation.
132 class CC_EXPORT BeginFrameSourceMixIn : public BeginFrameSource { 132 class CC_EXPORT BeginFrameSourceMixIn : public BeginFrameSource {
133 public: 133 public:
134 virtual ~BeginFrameSourceMixIn() {} 134 virtual ~BeginFrameSourceMixIn() {}
135 135
136 // BeginFrameSource 136 // BeginFrameSource
137 virtual bool NeedsBeginFrames() const OVERRIDE; 137 virtual bool NeedsBeginFrames() const override;
138 virtual void SetNeedsBeginFrames(bool needs_begin_frames) OVERRIDE; 138 virtual void SetNeedsBeginFrames(bool needs_begin_frames) override;
139 virtual void DidFinishFrame(size_t remaining_frames) OVERRIDE {} 139 virtual void DidFinishFrame(size_t remaining_frames) override {}
140 virtual void AddObserver(BeginFrameObserver* obs) OVERRIDE; 140 virtual void AddObserver(BeginFrameObserver* obs) override;
141 virtual void RemoveObserver(BeginFrameObserver* obs) OVERRIDE; 141 virtual void RemoveObserver(BeginFrameObserver* obs) override;
142 142
143 // Tracing support - Recommend (but not required) to call this implementation 143 // Tracing support - Recommend (but not required) to call this implementation
144 // in any override. 144 // in any override.
145 virtual void AsValueInto(base::debug::TracedValue* dict) const OVERRIDE; 145 virtual void AsValueInto(base::debug::TracedValue* dict) const override;
146 146
147 protected: 147 protected:
148 BeginFrameSourceMixIn(); 148 BeginFrameSourceMixIn();
149 149
150 // These methods should be used by subclasses to make the call to the 150 // These methods should be used by subclasses to make the call to the
151 // observers. 151 // observers.
152 void CallOnBeginFrame(const BeginFrameArgs& args); 152 void CallOnBeginFrame(const BeginFrameArgs& args);
153 153
154 // This method should be overridden if you want to change some behaviour on 154 // This method should be overridden if you want to change some behaviour on
155 // needs_begin_frames change. 155 // needs_begin_frames change.
156 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) {} 156 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) {}
157 157
158 BeginFrameObserver* observer_; 158 BeginFrameObserver* observer_;
159 bool needs_begin_frames_; 159 bool needs_begin_frames_;
160 160
161 private: 161 private:
162 bool inside_as_value_into_; 162 bool inside_as_value_into_;
163 }; 163 };
164 164
165 // A frame source which calls BeginFrame (at the next possible time) as soon as 165 // A frame source which calls BeginFrame (at the next possible time) as soon as
166 // remaining frames reaches zero. 166 // remaining frames reaches zero.
167 class CC_EXPORT BackToBackBeginFrameSource : public BeginFrameSourceMixIn { 167 class CC_EXPORT BackToBackBeginFrameSource : public BeginFrameSourceMixIn {
168 public: 168 public:
169 static scoped_ptr<BackToBackBeginFrameSource> Create( 169 static scoped_ptr<BackToBackBeginFrameSource> Create(
170 base::SingleThreadTaskRunner* task_runner); 170 base::SingleThreadTaskRunner* task_runner);
171 virtual ~BackToBackBeginFrameSource(); 171 virtual ~BackToBackBeginFrameSource();
172 172
173 // BeginFrameSource 173 // BeginFrameSource
174 virtual void DidFinishFrame(size_t remaining_frames) OVERRIDE; 174 virtual void DidFinishFrame(size_t remaining_frames) override;
175 175
176 // Tracing 176 // Tracing
177 virtual void AsValueInto(base::debug::TracedValue* dict) const OVERRIDE; 177 virtual void AsValueInto(base::debug::TracedValue* dict) const override;
178 178
179 protected: 179 protected:
180 explicit BackToBackBeginFrameSource( 180 explicit BackToBackBeginFrameSource(
181 base::SingleThreadTaskRunner* task_runner); 181 base::SingleThreadTaskRunner* task_runner);
182 virtual base::TimeTicks Now(); // Now overridable for testing 182 virtual base::TimeTicks Now(); // Now overridable for testing
183 183
184 base::WeakPtrFactory<BackToBackBeginFrameSource> weak_factory_; 184 base::WeakPtrFactory<BackToBackBeginFrameSource> weak_factory_;
185 base::SingleThreadTaskRunner* task_runner_; 185 base::SingleThreadTaskRunner* task_runner_;
186 186
187 bool send_begin_frame_posted_; 187 bool send_begin_frame_posted_;
188 188
189 // BeginFrameSourceMixIn 189 // BeginFrameSourceMixIn
190 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) OVERRIDE; 190 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) override;
191 191
192 void BeginFrame(); 192 void BeginFrame();
193 }; 193 };
194 194
195 // A frame source which is locked to an external parameters provides from a 195 // A frame source which is locked to an external parameters provides from a
196 // vsync source and generates BeginFrameArgs for it. 196 // vsync source and generates BeginFrameArgs for it.
197 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSourceMixIn, 197 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSourceMixIn,
198 public VSyncParameterObserver, 198 public VSyncParameterObserver,
199 public TimeSourceClient { 199 public TimeSourceClient {
200 public: 200 public:
201 static scoped_ptr<SyntheticBeginFrameSource> Create( 201 static scoped_ptr<SyntheticBeginFrameSource> Create(
202 base::SingleThreadTaskRunner* task_runner, 202 base::SingleThreadTaskRunner* task_runner,
203 base::TimeTicks initial_vsync_timebase, 203 base::TimeTicks initial_vsync_timebase,
204 base::TimeDelta initial_vsync_interval); 204 base::TimeDelta initial_vsync_interval);
205 virtual ~SyntheticBeginFrameSource(); 205 virtual ~SyntheticBeginFrameSource();
206 206
207 // BeginFrameSource 207 // BeginFrameSource
208 virtual bool NeedsBeginFrames() const OVERRIDE; 208 virtual bool NeedsBeginFrames() const override;
209 209
210 // Tracing 210 // Tracing
211 virtual void AsValueInto(base::debug::TracedValue* dict) const OVERRIDE; 211 virtual void AsValueInto(base::debug::TracedValue* dict) const override;
212 212
213 // VSyncParameterObserver 213 // VSyncParameterObserver
214 virtual void OnUpdateVSyncParameters( 214 virtual void OnUpdateVSyncParameters(
215 base::TimeTicks new_vsync_timebase, 215 base::TimeTicks new_vsync_timebase,
216 base::TimeDelta new_vsync_interval) OVERRIDE; 216 base::TimeDelta new_vsync_interval) override;
217 217
218 // TimeSourceClient 218 // TimeSourceClient
219 virtual void OnTimerTick() OVERRIDE; 219 virtual void OnTimerTick() override;
220 220
221 protected: 221 protected:
222 explicit SyntheticBeginFrameSource( 222 explicit SyntheticBeginFrameSource(
223 scoped_refptr<DelayBasedTimeSource> time_source); 223 scoped_refptr<DelayBasedTimeSource> time_source);
224 224
225 BeginFrameArgs CreateBeginFrameArgs(base::TimeTicks frame_time, 225 BeginFrameArgs CreateBeginFrameArgs(base::TimeTicks frame_time,
226 BeginFrameArgs::BeginFrameArgsType type); 226 BeginFrameArgs::BeginFrameArgsType type);
227 227
228 // BeginFrameSourceMixIn 228 // BeginFrameSourceMixIn
229 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) OVERRIDE; 229 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) override;
230 230
231 scoped_refptr<DelayBasedTimeSource> time_source_; 231 scoped_refptr<DelayBasedTimeSource> time_source_;
232 }; 232 };
233 233
234 // A "virtual" frame source which lets you switch between multiple other frame 234 // A "virtual" frame source which lets you switch between multiple other frame
235 // sources while making sure the BeginFrameArgs stays increasing (possibly 235 // sources while making sure the BeginFrameArgs stays increasing (possibly
236 // enforcing minimum boundry between BeginFrameArgs messages). 236 // enforcing minimum boundry between BeginFrameArgs messages).
237 class CC_EXPORT BeginFrameSourceMultiplexer : public BeginFrameSourceMixIn, 237 class CC_EXPORT BeginFrameSourceMultiplexer : public BeginFrameSourceMixIn,
238 public BeginFrameObserver { 238 public BeginFrameObserver {
239 public: 239 public:
240 static scoped_ptr<BeginFrameSourceMultiplexer> Create(); 240 static scoped_ptr<BeginFrameSourceMultiplexer> Create();
241 virtual ~BeginFrameSourceMultiplexer(); 241 virtual ~BeginFrameSourceMultiplexer();
242 242
243 void SetMinimumInterval(base::TimeDelta new_minimum_interval); 243 void SetMinimumInterval(base::TimeDelta new_minimum_interval);
244 244
245 void AddSource(BeginFrameSource* new_source); 245 void AddSource(BeginFrameSource* new_source);
246 void RemoveSource(BeginFrameSource* existing_source); 246 void RemoveSource(BeginFrameSource* existing_source);
247 void SetActiveSource(BeginFrameSource* new_source); 247 void SetActiveSource(BeginFrameSource* new_source);
248 const BeginFrameSource* ActiveSource(); 248 const BeginFrameSource* ActiveSource();
249 249
250 // BeginFrameObserver 250 // BeginFrameObserver
251 // The mux is an BeginFrameObserver as it needs to proxy the OnBeginFrame 251 // The mux is an BeginFrameObserver as it needs to proxy the OnBeginFrame
252 // calls to preserve the monotonicity of the BeginFrameArgs when switching 252 // calls to preserve the monotonicity of the BeginFrameArgs when switching
253 // sources. 253 // sources.
254 virtual void OnBeginFrame(const BeginFrameArgs& args) OVERRIDE; 254 virtual void OnBeginFrame(const BeginFrameArgs& args) override;
255 virtual const BeginFrameArgs LastUsedBeginFrameArgs() const OVERRIDE; 255 virtual const BeginFrameArgs LastUsedBeginFrameArgs() const override;
256 256
257 // BeginFrameSource 257 // BeginFrameSource
258 virtual bool NeedsBeginFrames() const OVERRIDE; 258 virtual bool NeedsBeginFrames() const override;
259 virtual void SetNeedsBeginFrames(bool needs_begin_frames) OVERRIDE; 259 virtual void SetNeedsBeginFrames(bool needs_begin_frames) override;
260 virtual void DidFinishFrame(size_t remaining_frames) OVERRIDE; 260 virtual void DidFinishFrame(size_t remaining_frames) override;
261 261
262 // Tracing 262 // Tracing
263 virtual void AsValueInto(base::debug::TracedValue* dict) const OVERRIDE; 263 virtual void AsValueInto(base::debug::TracedValue* dict) const override;
264 264
265 protected: 265 protected:
266 BeginFrameSourceMultiplexer(); 266 BeginFrameSourceMultiplexer();
267 explicit BeginFrameSourceMultiplexer(base::TimeDelta minimum_interval); 267 explicit BeginFrameSourceMultiplexer(base::TimeDelta minimum_interval);
268 268
269 bool HasSource(BeginFrameSource* source); 269 bool HasSource(BeginFrameSource* source);
270 bool IsIncreasing(const BeginFrameArgs& args); 270 bool IsIncreasing(const BeginFrameArgs& args);
271 271
272 base::TimeDelta minimum_interval_; 272 base::TimeDelta minimum_interval_;
273 273
274 BeginFrameSource* active_source_; 274 BeginFrameSource* active_source_;
275 std::set<BeginFrameSource*> source_list_; 275 std::set<BeginFrameSource*> source_list_;
276 }; 276 };
277 277
278 } // namespace cc 278 } // namespace cc
279 279
280 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ 280 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_
OLDNEW
« no previous file with comments | « cc/resources/zero_copy_raster_worker_pool.cc ('k') | cc/scheduler/begin_frame_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698