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

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

Issue 2632563003: [cc] Calculate the correct latest_confirmed_sequence_number in cc::Scheduler. (Closed)
Patch Set: Created 3 years, 11 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 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_SCHEDULER_STATE_MACHINE_H_ 5 #ifndef CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
6 #define CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ 6 #define CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
7 7
8 #include <stdint.h>
9
8 #include <memory> 10 #include <memory>
9 #include <string> 11 #include <string>
10 12
11 #include "base/macros.h" 13 #include "base/macros.h"
12 #include "cc/base/cc_export.h" 14 #include "cc/base/cc_export.h"
13 #include "cc/output/begin_frame_args.h"
14 #include "cc/scheduler/commit_earlyout_reason.h" 15 #include "cc/scheduler/commit_earlyout_reason.h"
15 #include "cc/scheduler/draw_result.h" 16 #include "cc/scheduler/draw_result.h"
16 #include "cc/scheduler/scheduler_settings.h" 17 #include "cc/scheduler/scheduler_settings.h"
17 #include "cc/tiles/tile_priority.h" 18 #include "cc/tiles/tile_priority.h"
18 19
19 namespace base { 20 namespace base {
20 namespace trace_event { 21 namespace trace_event {
21 class ConvertableToTraceFormat; 22 class ConvertableToTraceFormat;
22 class TracedValue; 23 class TracedValue;
23 } 24 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 141
141 void AbortDraw(); 142 void AbortDraw();
142 143
143 // Indicates whether the impl thread needs a BeginImplFrame callback in order 144 // Indicates whether the impl thread needs a BeginImplFrame callback in order
144 // to make progress. 145 // to make progress.
145 bool BeginFrameNeeded() const; 146 bool BeginFrameNeeded() const;
146 147
147 // Indicates that the system has entered and left a BeginImplFrame callback. 148 // Indicates that the system has entered and left a BeginImplFrame callback.
148 // The scheduler will not draw more than once in a given BeginImplFrame 149 // The scheduler will not draw more than once in a given BeginImplFrame
149 // callback nor send more than one BeginMainFrame message. 150 // callback nor send more than one BeginMainFrame message.
150 void OnBeginImplFrame(); 151 void OnBeginImplFrame(uint32_t source_id, uint64_t sequence_number);
151 // Indicates that the scheduler has entered the draw phase. The scheduler 152 // Indicates that the scheduler has entered the draw phase. The scheduler
152 // will not draw more than once in a single draw phase. 153 // will not draw more than once in a single draw phase.
153 // TODO(sunnyps): Rename OnBeginImplFrameDeadline to OnDraw or similar. 154 // TODO(sunnyps): Rename OnBeginImplFrameDeadline to OnDraw or similar.
154 void OnBeginImplFrameDeadline(); 155 void OnBeginImplFrameDeadline();
155 void OnBeginImplFrameIdle(); 156 void OnBeginImplFrameIdle();
156 157
157 int current_frame_number() const { return current_frame_number_; } 158 uint64_t current_frame_number() const { return current_frame_number_; }
158 159
159 BeginImplFrameState begin_impl_frame_state() const { 160 BeginImplFrameState begin_impl_frame_state() const {
160 return begin_impl_frame_state_; 161 return begin_impl_frame_state_;
161 } 162 }
162 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; 163 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const;
163 164
164 // If the main thread didn't manage to produce a new frame in time for the 165 // If the main thread didn't manage to produce a new frame in time for the
165 // impl thread to draw, it is in a high latency mode. 166 // impl thread to draw, it is in a high latency mode.
166 bool main_thread_missed_last_deadline() const { 167 bool main_thread_missed_last_deadline() const {
167 return main_thread_missed_last_deadline_; 168 return main_thread_missed_last_deadline_;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 bool PendingDrawsShouldBeAborted() const; 264 bool PendingDrawsShouldBeAborted() const;
264 265
265 bool CouldSendBeginMainFrame() const; 266 bool CouldSendBeginMainFrame() const;
266 267
267 void SetDeferCommits(bool defer_commits); 268 void SetDeferCommits(bool defer_commits);
268 269
269 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); 270 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames);
270 bool video_needs_begin_frames() const { return video_needs_begin_frames_; } 271 bool video_needs_begin_frames() const { return video_needs_begin_frames_; }
271 272
272 bool did_submit_in_last_frame() const { return did_submit_in_last_frame_; } 273 bool did_submit_in_last_frame() const { return did_submit_in_last_frame_; }
274 uint64_t last_frame_number_compositor_frame_was_fresh() const {
275 return last_frame_number_compositor_frame_was_fresh_;
276 }
273 277
274 protected: 278 protected:
275 bool BeginFrameRequiredForAction() const; 279 bool BeginFrameRequiredForAction() const;
276 bool BeginFrameNeededForVideo() const; 280 bool BeginFrameNeededForVideo() const;
277 bool ProactiveBeginFrameWanted() const; 281 bool ProactiveBeginFrameWanted() const;
278 282
279 bool ShouldTriggerBeginImplFrameDeadlineImmediately() const; 283 bool ShouldTriggerBeginImplFrameDeadlineImmediately() const;
280 284
281 // True if we need to force activations to make forward progress. 285 // True if we need to force activations to make forward progress.
282 // TODO(sunnyps): Rename this to ShouldAbortCurrentFrame or similar. 286 // TODO(sunnyps): Rename this to ShouldAbortCurrentFrame or similar.
(...skipping 10 matching lines...) Expand all
293 void WillDrawInternal(); 297 void WillDrawInternal();
294 void DidDrawInternal(DrawResult draw_result); 298 void DidDrawInternal(DrawResult draw_result);
295 299
296 const SchedulerSettings settings_; 300 const SchedulerSettings settings_;
297 301
298 CompositorFrameSinkState compositor_frame_sink_state_; 302 CompositorFrameSinkState compositor_frame_sink_state_;
299 BeginImplFrameState begin_impl_frame_state_; 303 BeginImplFrameState begin_impl_frame_state_;
300 BeginMainFrameState begin_main_frame_state_; 304 BeginMainFrameState begin_main_frame_state_;
301 ForcedRedrawOnTimeoutState forced_redraw_state_; 305 ForcedRedrawOnTimeoutState forced_redraw_state_;
302 306
303 // These are used for tracing only. 307 // These are used for tracing and BeginFrame acknowledgments.
304 int commit_count_; 308 int commit_count_;
305 int current_frame_number_; 309 uint32_t begin_frame_source_id_;
306 int last_frame_number_submit_performed_; 310 uint64_t current_frame_number_;
307 int last_frame_number_draw_performed_; 311 uint64_t last_frame_number_submit_performed_;
308 int last_frame_number_begin_main_frame_sent_; 312 uint64_t last_frame_number_draw_performed_;
309 int last_frame_number_invalidate_compositor_frame_sink_performed_; 313 uint64_t last_frame_number_begin_main_frame_sent_;
314 uint64_t last_frame_number_invalidate_compositor_frame_sink_performed_;
315 uint64_t last_frame_number_pending_tree_was_fresh_;
316 uint64_t last_frame_number_active_tree_was_fresh_;
317 uint64_t last_frame_number_compositor_frame_was_fresh_;
310 318
311 // These are used to ensure that an action only happens once per frame, 319 // These are used to ensure that an action only happens once per frame,
312 // deadline, etc. 320 // deadline, etc.
313 bool draw_funnel_; 321 bool draw_funnel_;
314 bool send_begin_main_frame_funnel_; 322 bool send_begin_main_frame_funnel_;
315 bool invalidate_compositor_frame_sink_funnel_; 323 bool invalidate_compositor_frame_sink_funnel_;
316 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called 324 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called
317 // and "drained" on each BeginImplFrame. If the funnel gets too full, 325 // and "drained" on each BeginImplFrame. If the funnel gets too full,
318 // we start throttling ACTION_PREPARE_TILES such that we average one 326 // we start throttling ACTION_PREPARE_TILES such that we average one
319 // PrepareTiles per BeginImplFrame. 327 // PrepareTiles per BeginImplFrame.
(...skipping 26 matching lines...) Expand all
346 bool did_draw_in_last_frame_; 354 bool did_draw_in_last_frame_;
347 bool did_submit_in_last_frame_; 355 bool did_submit_in_last_frame_;
348 356
349 private: 357 private:
350 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); 358 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);
351 }; 359 };
352 360
353 } // namespace cc 361 } // namespace cc
354 362
355 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ 363 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698