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

Unified Diff: cc/scheduler/scheduler_state_machine.h

Issue 2632563003: [cc] Calculate the correct latest_confirmed_sequence_number in cc::Scheduler. (Closed)
Patch Set: Fix handling of source_id changes and add some Scheduler tests. 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 side-by-side diff with in-line comments
Download patch
Index: cc/scheduler/scheduler_state_machine.h
diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h
index 3272588d56894ee6b27ef4fd2977109052bbba27..885aed77288ba73b5cfbfab98574893254b6ea34 100644
--- a/cc/scheduler/scheduler_state_machine.h
+++ b/cc/scheduler/scheduler_state_machine.h
@@ -5,12 +5,13 @@
#ifndef CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
#define CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
+#include <stdint.h>
+
#include <memory>
#include <string>
#include "base/macros.h"
#include "cc/base/cc_export.h"
-#include "cc/output/begin_frame_args.h"
#include "cc/scheduler/commit_earlyout_reason.h"
#include "cc/scheduler/draw_result.h"
#include "cc/scheduler/scheduler_settings.h"
@@ -144,10 +145,16 @@ class CC_EXPORT SchedulerStateMachine {
// to make progress.
bool BeginFrameNeeded() const;
+ // Indicates that the Scheduler has received a BeginFrame that did not require
+ // a BeginImplFrame, because the Scheduler stopped observing BeginFrames.
+ // Updates the sequence and freshness numbers for the dropped BeginFrame.
+ void OnBeginFrameDroppedNotObserving(uint32_t source_id,
+ uint64_t sequence_number);
+
// Indicates that the system has entered and left a BeginImplFrame callback.
// The scheduler will not draw more than once in a given BeginImplFrame
// callback nor send more than one BeginMainFrame message.
- void OnBeginImplFrame();
+ void OnBeginImplFrame(uint32_t source_id, uint64_t sequence_number);
// Indicates that the scheduler has entered the draw phase. The scheduler
// will not draw more than once in a single draw phase.
// TODO(sunnyps): Rename OnBeginImplFrameDeadline to OnDraw or similar.
@@ -271,6 +278,11 @@ class CC_EXPORT SchedulerStateMachine {
bool did_submit_in_last_frame() const { return did_submit_in_last_frame_; }
+ uint32_t begin_frame_source_id() const { return begin_frame_source_id_; }
+ uint64_t last_begin_frame_sequence_number_compositor_frame_was_fresh() const {
+ return last_begin_frame_sequence_number_compositor_frame_was_fresh_;
+ }
+
protected:
bool BeginFrameRequiredForAction() const;
bool BeginFrameNeededForVideo() const;
@@ -293,6 +305,10 @@ class CC_EXPORT SchedulerStateMachine {
void WillDrawInternal();
void DidDrawInternal(DrawResult draw_result);
+ void UpdateBeginFrameSequenceNumbersForBeginFrame(uint32_t source_id,
+ uint64_t sequence_number);
+ void UpdateBeginFrameSequenceNumbersForBeginFrameDeadline();
+
const SchedulerSettings settings_;
CompositorFrameSinkState compositor_frame_sink_state_;
@@ -300,6 +316,16 @@ class CC_EXPORT SchedulerStateMachine {
BeginMainFrameState begin_main_frame_state_;
ForcedRedrawOnTimeoutState forced_redraw_state_;
+ // These fields are used to track the freshness of pending updates in the
+ // commit/activate/draw pipeline. The Scheduler uses the CompositorFrame's
+ // freshness to fill the |latest_confirmed_frame| field in BeginFrameAcks.
+ uint32_t begin_frame_source_id_;
+ uint64_t begin_frame_sequence_number_;
+ uint64_t last_begin_frame_sequence_number_begin_main_frame_sent_;
+ uint64_t last_begin_frame_sequence_number_pending_tree_was_fresh_;
+ uint64_t last_begin_frame_sequence_number_active_tree_was_fresh_;
+ uint64_t last_begin_frame_sequence_number_compositor_frame_was_fresh_;
+
// These are used for tracing only.
int commit_count_;
int current_frame_number_;

Powered by Google App Engine
This is Rietveld 408576698