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

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

Issue 1840223002: cc: Remove BeginFrameSource::Create methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | cc/scheduler/begin_frame_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 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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 private: 171 private:
172 bool inside_as_value_into_; 172 bool inside_as_value_into_;
173 173
174 DISALLOW_COPY_AND_ASSIGN(BeginFrameSourceBase); 174 DISALLOW_COPY_AND_ASSIGN(BeginFrameSourceBase);
175 }; 175 };
176 176
177 // A frame source which calls BeginFrame (at the next possible time) as soon as 177 // A frame source which calls BeginFrame (at the next possible time) as soon as
178 // remaining frames reaches zero. 178 // remaining frames reaches zero.
179 class CC_EXPORT BackToBackBeginFrameSource : public BeginFrameSourceBase { 179 class CC_EXPORT BackToBackBeginFrameSource : public BeginFrameSourceBase {
180 public: 180 public:
181 static scoped_ptr<BackToBackBeginFrameSource> Create( 181 explicit BackToBackBeginFrameSource(
182 base::SingleThreadTaskRunner* task_runner); 182 base::SingleThreadTaskRunner* task_runner);
183 ~BackToBackBeginFrameSource() override; 183 ~BackToBackBeginFrameSource() override;
184 184
185 // BeginFrameSource 185 // BeginFrameSource
186 void DidFinishFrame(size_t remaining_frames) override; 186 void DidFinishFrame(size_t remaining_frames) override;
187 187
188 // BeginFrameSourceBase 188 // BeginFrameSourceBase
189 void AddObserver(BeginFrameObserver* obs) override; 189 void AddObserver(BeginFrameObserver* obs) override;
190 void OnNeedsBeginFramesChanged(bool needs_begin_frames) override; 190 void OnNeedsBeginFramesChanged(bool needs_begin_frames) override;
191 191
192 // Tracing 192 // Tracing
193 void AsValueInto(base::trace_event::TracedValue* dict) const override; 193 void AsValueInto(base::trace_event::TracedValue* dict) const override;
194 194
195 protected: 195 protected:
196 explicit BackToBackBeginFrameSource(
197 base::SingleThreadTaskRunner* task_runner);
198 virtual base::TimeTicks Now(); // Now overridable for testing 196 virtual base::TimeTicks Now(); // Now overridable for testing
199 197
200 base::SingleThreadTaskRunner* task_runner_; 198 base::SingleThreadTaskRunner* task_runner_;
201 base::CancelableClosure begin_frame_task_; 199 base::CancelableClosure begin_frame_task_;
202 200
203 void PostBeginFrame(); 201 void PostBeginFrame();
204 void BeginFrame(); 202 void BeginFrame();
205 203
206 private: 204 private:
207 base::WeakPtrFactory<BackToBackBeginFrameSource> weak_factory_; 205 base::WeakPtrFactory<BackToBackBeginFrameSource> weak_factory_;
208 206
209 DISALLOW_COPY_AND_ASSIGN(BackToBackBeginFrameSource); 207 DISALLOW_COPY_AND_ASSIGN(BackToBackBeginFrameSource);
210 }; 208 };
211 209
212 // A frame source which is locked to an external parameters provides from a 210 // A frame source which is locked to an external parameters provides from a
213 // vsync source and generates BeginFrameArgs for it. 211 // vsync source and generates BeginFrameArgs for it.
214 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSourceBase, 212 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSourceBase,
215 public DelayBasedTimeSourceClient { 213 public DelayBasedTimeSourceClient {
216 public: 214 public:
217 static scoped_ptr<SyntheticBeginFrameSource> Create( 215 explicit SyntheticBeginFrameSource(base::SingleThreadTaskRunner* task_runner,
218 base::SingleThreadTaskRunner* task_runner, 216 base::TimeDelta initial_vsync_interval);
219 base::TimeDelta initial_vsync_interval); 217 explicit SyntheticBeginFrameSource(
218 scoped_ptr<DelayBasedTimeSource> time_source);
danakj 2016/03/29 21:32:32 This one is only meant for subclasses?
enne (OOO) 2016/03/29 21:35:14 That is how it is currently used, yes. But, I don
220 ~SyntheticBeginFrameSource() override; 219 ~SyntheticBeginFrameSource() override;
221 220
222 void OnUpdateVSyncParameters(base::TimeTicks new_vsync_timebase, 221 void OnUpdateVSyncParameters(base::TimeTicks new_vsync_timebase,
223 base::TimeDelta new_vsync_interval); 222 base::TimeDelta new_vsync_interval);
224 223
225 // BeginFrameSourceBase 224 // BeginFrameSourceBase
226 void AddObserver(BeginFrameObserver* obs) override; 225 void AddObserver(BeginFrameObserver* obs) override;
227 void OnNeedsBeginFramesChanged(bool needs_begin_frames) override; 226 void OnNeedsBeginFramesChanged(bool needs_begin_frames) override;
228 227
229 // Tracing 228 // Tracing
230 void AsValueInto(base::trace_event::TracedValue* dict) const override; 229 void AsValueInto(base::trace_event::TracedValue* dict) const override;
231 230
232 // DelayBasedTimeSourceClient 231 // DelayBasedTimeSourceClient
233 void OnTimerTick() override; 232 void OnTimerTick() override;
234 233
235 protected: 234 protected:
236 explicit SyntheticBeginFrameSource(
237 scoped_ptr<DelayBasedTimeSource> time_source);
238
239 BeginFrameArgs CreateBeginFrameArgs(base::TimeTicks frame_time, 235 BeginFrameArgs CreateBeginFrameArgs(base::TimeTicks frame_time,
240 BeginFrameArgs::BeginFrameArgsType type); 236 BeginFrameArgs::BeginFrameArgsType type);
241 237
242 scoped_ptr<DelayBasedTimeSource> time_source_; 238 scoped_ptr<DelayBasedTimeSource> time_source_;
243 239
244 private: 240 private:
245 DISALLOW_COPY_AND_ASSIGN(SyntheticBeginFrameSource); 241 DISALLOW_COPY_AND_ASSIGN(SyntheticBeginFrameSource);
246 }; 242 };
247 243
248 } // namespace cc 244 } // namespace cc
249 245
250 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ 246 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_
OLDNEW
« no previous file with comments | « no previous file | cc/scheduler/begin_frame_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698