Commit bd2c8968 authored by sunnyps's avatar sunnyps Committed by Commit bot

cc: Do not pass BeginFrameArgs to state machine.

The scheduler state machine should not rely on BeginFrameArgs for any
decision. The state machine is the "digital" part of the system while
the scheduler is the "analog" part of the system.

BUG=439275

Review URL: https://codereview.chromium.org/1020993002

Cr-Commit-Position: refs/heads/master@{#321476}
parent 27f3e335
......@@ -534,7 +534,7 @@ void Scheduler::BeginImplFrame(const BeginFrameArgs& args) {
state_machine_.SetSkipNextBeginMainFrameToReduceLatency();
}
state_machine_.OnBeginImplFrame(begin_impl_frame_args_);
state_machine_.OnBeginImplFrame();
devtools_instrumentation::DidBeginFrame(layer_tree_host_id_);
client_->WillBeginImplFrame(begin_impl_frame_args_);
......@@ -803,7 +803,7 @@ scoped_refptr<base::trace_event::ConvertableToTraceFormat> Scheduler::AsValue()
void Scheduler::AsValueInto(base::trace_event::TracedValue* state) const {
state->BeginDictionary("state_machine");
state_machine_.AsValueInto(state, Now());
state_machine_.AsValueInto(state);
state->EndDictionary();
// Only trace frame sources when explicitly enabled - http://crbug.com/420607
......@@ -837,6 +837,23 @@ void Scheduler::AsValueInto(base::trace_event::TracedValue* state) const {
begin_impl_frame_args_.AsValueInto(state);
state->EndDictionary();
base::TimeTicks now = Now();
base::TimeTicks frame_time = begin_impl_frame_args_.frame_time;
base::TimeTicks deadline = begin_impl_frame_args_.deadline;
base::TimeDelta interval = begin_impl_frame_args_.interval;
state->BeginDictionary("major_timestamps_in_ms");
state->SetDouble("0_interval", interval.InMillisecondsF());
state->SetDouble("1_now_to_deadline", (deadline - now).InMillisecondsF());
state->SetDouble("2_frame_time_to_now", (now - frame_time).InMillisecondsF());
state->SetDouble("3_frame_time_to_deadline",
(deadline - frame_time).InMillisecondsF());
state->SetDouble("4_now", (now - base::TimeTicks()).InMillisecondsF());
state->SetDouble("5_frame_time",
(frame_time - base::TimeTicks()).InMillisecondsF());
state->SetDouble("6_deadline",
(deadline - base::TimeTicks()).InMillisecondsF());
state->EndDictionary();
state->EndDictionary();
state->BeginDictionary("client_state");
......
......@@ -151,12 +151,12 @@ scoped_refptr<base::trace_event::ConvertableToTraceFormat>
SchedulerStateMachine::AsValue() const {
scoped_refptr<base::trace_event::TracedValue> state =
new base::trace_event::TracedValue();
AsValueInto(state.get(), gfx::FrameTime::Now());
AsValueInto(state.get());
return state;
}
void SchedulerStateMachine::AsValueInto(base::trace_event::TracedValue* state,
base::TimeTicks now) const {
void SchedulerStateMachine::AsValueInto(
base::trace_event::TracedValue* state) const {
state->BeginDictionary("major_state");
state->SetString("next_action", ActionToString(NextAction()));
state->SetString("begin_impl_frame_state",
......@@ -168,31 +168,6 @@ void SchedulerStateMachine::AsValueInto(base::trace_event::TracedValue* state,
ForcedRedrawOnTimeoutStateToString(forced_redraw_state_));
state->EndDictionary();
state->BeginDictionary("major_timestamps_in_ms");
state->SetDouble("0_interval",
begin_impl_frame_args_.interval.InMicroseconds() / 1000.0L);
state->SetDouble(
"1_now_to_deadline",
(begin_impl_frame_args_.deadline - now).InMicroseconds() / 1000.0L);
state->SetDouble(
"2_frame_time_to_now",
(now - begin_impl_frame_args_.frame_time).InMicroseconds() / 1000.0L);
state->SetDouble("3_frame_time_to_deadline",
(begin_impl_frame_args_.deadline -
begin_impl_frame_args_.frame_time).InMicroseconds() /
1000.0L);
state->SetDouble("4_now",
(now - base::TimeTicks()).InMicroseconds() / 1000.0L);
state->SetDouble(
"5_frame_time",
(begin_impl_frame_args_.frame_time - base::TimeTicks()).InMicroseconds() /
1000.0L);
state->SetDouble(
"6_deadline",
(begin_impl_frame_args_.deadline - base::TimeTicks()).InMicroseconds() /
1000.0L);
state->EndDictionary();
state->BeginDictionary("minor_state");
state->SetInteger("commit_count", commit_count_);
state->SetInteger("current_frame_number", current_frame_number_);
......@@ -798,9 +773,8 @@ bool SchedulerStateMachine::ProactiveBeginFrameWanted() const {
return false;
}
void SchedulerStateMachine::OnBeginImplFrame(const BeginFrameArgs& args) {
void SchedulerStateMachine::OnBeginImplFrame() {
AdvanceCurrentFrameNumber();
begin_impl_frame_args_ = args;
DCHECK_EQ(begin_impl_frame_state_, BEGIN_IMPL_FRAME_STATE_IDLE)
<< AsValue()->ToString();
begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING;
......
......@@ -9,7 +9,6 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "cc/base/cc_export.h"
#include "cc/output/begin_frame_args.h"
#include "cc/scheduler/commit_earlyout_reason.h"
......@@ -115,8 +114,7 @@ class CC_EXPORT SchedulerStateMachine {
static const char* ActionToString(Action action);
scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
void AsValueInto(base::trace_event::TracedValue* dict,
base::TimeTicks now) const;
void AsValueInto(base::trace_event::TracedValue* dict) const;
Action NextAction() const;
void UpdateState(Action action);
......@@ -134,7 +132,7 @@ class CC_EXPORT SchedulerStateMachine {
// 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(const BeginFrameArgs& args);
void OnBeginImplFrame();
void OnBeginImplFrameDeadlinePending();
void OnBeginImplFrameDeadline();
void OnBeginImplFrameIdle();
......@@ -297,8 +295,6 @@ class CC_EXPORT SchedulerStateMachine {
CommitState commit_state_;
ForcedRedrawOnTimeoutState forced_redraw_state_;
BeginFrameArgs begin_impl_frame_args_;
int commit_count_;
int current_frame_number_;
int last_frame_number_animate_performed_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment