Commit d9168de8 authored by mithro's avatar mithro Committed by Commit bot

Adding AsValueInto to scheduler.

Also makes the scheduler state machine output use the scheduler Now() value so
the output is identical on every run during tests.

BUG=380889

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

Cr-Commit-Position: refs/heads/master@{#295251}
parent 4837a289
......@@ -698,12 +698,17 @@ scoped_refptr<base::debug::ConvertableToTraceFormat> Scheduler::AsValue()
const {
scoped_refptr<base::debug::TracedValue> state =
new base::debug::TracedValue();
AsValueInto(state.get());
return state;
}
void Scheduler::AsValueInto(base::debug::TracedValue* state) const {
state->BeginDictionary("state_machine");
state_machine_.AsValueInto(state.get());
state_machine_.AsValueInto(state, Now());
state->EndDictionary();
if (synthetic_begin_frame_source_) {
state->BeginDictionary("synthetic_begin_frame_source_");
synthetic_begin_frame_source_->AsValueInto(state.get());
synthetic_begin_frame_source_->AsValueInto(state);
state->EndDictionary();
}
......@@ -725,7 +730,7 @@ scoped_refptr<base::debug::ConvertableToTraceFormat> Scheduler::AsValue()
state->SetBoolean("advance_commit_state_task_",
!advance_commit_state_task_.IsCancelled());
state->BeginDictionary("begin_impl_frame_args");
begin_impl_frame_args_.AsValueInto(state.get());
begin_impl_frame_args_.AsValueInto(state);
state->EndDictionary();
state->EndDictionary();
......@@ -740,7 +745,6 @@ scoped_refptr<base::debug::ConvertableToTraceFormat> Scheduler::AsValue()
"commit_to_activate_duration_estimate_ms",
client_->CommitToActivateDurationEstimate().InMillisecondsF());
state->EndDictionary();
return state;
}
bool Scheduler::CanCommitAndActivateBeforeDeadline() const {
......
......@@ -128,6 +128,7 @@ class CC_EXPORT Scheduler {
void BeginFrame(const BeginFrameArgs& args);
scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const;
void AsValueInto(base::debug::TracedValue* state) const;
void SetContinuousPainting(bool continuous_painting) {
state_machine_.SetContinuousPainting(continuous_painting);
......
......@@ -152,11 +152,12 @@ scoped_refptr<base::debug::ConvertableToTraceFormat>
SchedulerStateMachine::AsValue() const {
scoped_refptr<base::debug::TracedValue> state =
new base::debug::TracedValue();
AsValueInto(state.get());
AsValueInto(state.get(), gfx::FrameTime::Now());
return state;
}
void SchedulerStateMachine::AsValueInto(base::debug::TracedValue* state) const {
void SchedulerStateMachine::AsValueInto(base::debug::TracedValue* state,
base::TimeTicks now) const {
state->BeginDictionary("major_state");
state->SetString("next_action", ActionToString(NextAction()));
state->SetString("begin_impl_frame_state",
......@@ -169,7 +170,6 @@ void SchedulerStateMachine::AsValueInto(base::debug::TracedValue* state) const {
state->EndDictionary();
state->BeginDictionary("major_timestamps_in_ms");
base::TimeTicks now = gfx::FrameTime::Now();
state->SetDouble("0_interval",
begin_impl_frame_args_.interval.InMicroseconds() / 1000.0L);
state->SetDouble(
......
......@@ -107,7 +107,7 @@ class CC_EXPORT SchedulerStateMachine {
static const char* ActionToString(Action action);
scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const;
void AsValueInto(base::debug::TracedValue* dict) const;
void AsValueInto(base::debug::TracedValue* dict, base::TimeTicks now) const;
Action NextAction() const;
void UpdateState(Action action);
......
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