| Index: cc/scheduler/scheduler.cc | 
| diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc | 
| index 1451237cd9ff0cbd94a91a038a88c50585ed291b..52e0f9e093e4dc560c7af23768ef568caf0e9f3b 100644 | 
| --- a/cc/scheduler/scheduler.cc | 
| +++ b/cc/scheduler/scheduler.cc | 
| @@ -7,7 +7,6 @@ | 
| #include <algorithm> | 
| #include "base/auto_reset.h" | 
| #include "base/debug/trace_event.h" | 
| -#include "base/debug/trace_event_argument.h" | 
| #include "base/logging.h" | 
| #include "base/single_thread_task_runner.h" | 
| #include "cc/debug/devtools_instrumentation.h" | 
| @@ -62,9 +61,8 @@ | 
| scheduler_->BeginFrame(begin_frame_args); | 
| } | 
|  | 
| -void Scheduler::SyntheticBeginFrameSource::AsValueInto( | 
| -    base::debug::TracedValue* state) const { | 
| -  time_source_->AsValueInto(state); | 
| +scoped_ptr<base::Value> Scheduler::SyntheticBeginFrameSource::AsValue() const { | 
| +  return time_source_->AsValue(); | 
| } | 
|  | 
| BeginFrameArgs | 
| @@ -95,7 +93,7 @@ | 
| TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), | 
| "Scheduler::Scheduler", | 
| "settings", | 
| -               settings_.AsValue()); | 
| +               ToTrace(settings_)); | 
| DCHECK(client_); | 
| DCHECK(!state_machine_.BeginFrameNeeded()); | 
| if (settings_.main_frame_before_activation_enabled) { | 
| @@ -401,7 +399,7 @@ | 
| // If the scheduler is busy, we queue the BeginFrame to be handled later as | 
| // a BeginRetroFrame. | 
| void Scheduler::BeginFrame(const BeginFrameArgs& args) { | 
| -  TRACE_EVENT1("cc", "Scheduler::BeginFrame", "args", args.AsValue()); | 
| +  TRACE_EVENT1("cc", "Scheduler::BeginFrame", "args", ToTrace(args)); | 
| DCHECK(settings_.throttle_frame_production); | 
|  | 
| BeginFrameArgs adjusted_args(args); | 
| @@ -498,7 +496,7 @@ | 
| // for a BeginMainFrame+activation to complete before it times out and draws | 
| // any asynchronous animation and scroll/pinch updates. | 
| void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { | 
| -  TRACE_EVENT1("cc", "Scheduler::BeginImplFrame", "args", args.AsValue()); | 
| +  TRACE_EVENT1("cc", "Scheduler::BeginImplFrame", "args", ToTrace(args)); | 
| DCHECK(state_machine_.begin_impl_frame_state() == | 
| SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | 
| DCHECK(state_machine_.HasInitializedOutputSurface()); | 
| @@ -628,7 +626,7 @@ | 
| TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), | 
| "SchedulerStateMachine", | 
| "state", | 
| -                 AsValue()); | 
| +                 ToTrace(this)); | 
| state_machine_.UpdateState(action); | 
| base::AutoReset<SchedulerStateMachine::Action> | 
| mark_inside_action(&inside_action_, action); | 
| @@ -682,54 +680,51 @@ | 
| return !state_machine_.PendingDrawsShouldBeAborted(); | 
| } | 
|  | 
| -scoped_refptr<base::debug::ConvertableToTraceFormat> Scheduler::AsValue() | 
| -    const { | 
| -  scoped_refptr<base::debug::TracedValue> state = | 
| -      new base::debug::TracedValue(); | 
| -  state->BeginDictionary("state_machine"); | 
| -  state_machine_.AsValueInto(state); | 
| -  state->EndDictionary(); | 
| -  if (synthetic_begin_frame_source_) { | 
| -    state->BeginDictionary("synthetic_begin_frame_source_"); | 
| -    synthetic_begin_frame_source_->AsValueInto(state); | 
| -    state->EndDictionary(); | 
| -  } | 
| - | 
| -  state->BeginDictionary("scheduler_state"); | 
| -  state->SetDouble( | 
| +scoped_ptr<base::Value> Scheduler::AsValue() const { | 
| +  scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue); | 
| +  state->Set("state_machine", state_machine_.AsValue().release()); | 
| +  if (synthetic_begin_frame_source_) | 
| +    state->Set("synthetic_begin_frame_source_", | 
| +               synthetic_begin_frame_source_->AsValue().release()); | 
| + | 
| +  scoped_ptr<base::DictionaryValue> scheduler_state(new base::DictionaryValue); | 
| +  scheduler_state->SetDouble( | 
| "time_until_anticipated_draw_time_ms", | 
| (AnticipatedDrawTime() - base::TimeTicks::Now()).InMillisecondsF()); | 
| -  state->SetDouble("vsync_interval_ms", vsync_interval_.InMillisecondsF()); | 
| -  state->SetDouble("estimated_parent_draw_time_ms", | 
| -                   estimated_parent_draw_time_.InMillisecondsF()); | 
| -  state->SetBoolean("last_set_needs_begin_frame_", last_set_needs_begin_frame_); | 
| -  state->SetBoolean("begin_unthrottled_frame_posted_", | 
| -                    begin_unthrottled_frame_posted_); | 
| -  state->SetBoolean("begin_retro_frame_posted_", begin_retro_frame_posted_); | 
| -  state->SetInteger("begin_retro_frame_args_", begin_retro_frame_args_.size()); | 
| -  state->SetBoolean("begin_impl_frame_deadline_task_", | 
| -                    !begin_impl_frame_deadline_task_.IsCancelled()); | 
| -  state->SetBoolean("poll_for_draw_triggers_task_", | 
| -                    !poll_for_draw_triggers_task_.IsCancelled()); | 
| -  state->SetBoolean("advance_commit_state_task_", | 
| -                    !advance_commit_state_task_.IsCancelled()); | 
| -  state->BeginDictionary("begin_impl_frame_args"); | 
| -  begin_impl_frame_args_.AsValueInto(state); | 
| -  state->EndDictionary(); | 
| - | 
| -  state->EndDictionary(); | 
| - | 
| -  state->BeginDictionary("client_state"); | 
| -  state->SetDouble("draw_duration_estimate_ms", | 
| -                   client_->DrawDurationEstimate().InMillisecondsF()); | 
| -  state->SetDouble( | 
| +  scheduler_state->SetDouble("vsync_interval_ms", | 
| +                             vsync_interval_.InMillisecondsF()); | 
| +  scheduler_state->SetDouble("estimated_parent_draw_time_ms", | 
| +                             estimated_parent_draw_time_.InMillisecondsF()); | 
| +  scheduler_state->SetBoolean("last_set_needs_begin_frame_", | 
| +                              last_set_needs_begin_frame_); | 
| +  scheduler_state->SetBoolean("begin_unthrottled_frame_posted_", | 
| +                              begin_unthrottled_frame_posted_); | 
| +  scheduler_state->SetBoolean("begin_retro_frame_posted_", | 
| +                              begin_retro_frame_posted_); | 
| +  scheduler_state->SetInteger("begin_retro_frame_args_", | 
| +                              begin_retro_frame_args_.size()); | 
| +  scheduler_state->SetBoolean("begin_impl_frame_deadline_task_", | 
| +                              !begin_impl_frame_deadline_task_.IsCancelled()); | 
| +  scheduler_state->SetBoolean("poll_for_draw_triggers_task_", | 
| +                              !poll_for_draw_triggers_task_.IsCancelled()); | 
| +  scheduler_state->SetBoolean("advance_commit_state_task_", | 
| +                              !advance_commit_state_task_.IsCancelled()); | 
| +  scheduler_state->Set("begin_impl_frame_args", | 
| +                       begin_impl_frame_args_.AsValue().release()); | 
| + | 
| +  state->Set("scheduler_state", scheduler_state.release()); | 
| + | 
| +  scoped_ptr<base::DictionaryValue> client_state(new base::DictionaryValue); | 
| +  client_state->SetDouble("draw_duration_estimate_ms", | 
| +                          client_->DrawDurationEstimate().InMillisecondsF()); | 
| +  client_state->SetDouble( | 
| "begin_main_frame_to_commit_duration_estimate_ms", | 
| client_->BeginMainFrameToCommitDurationEstimate().InMillisecondsF()); | 
| -  state->SetDouble( | 
| +  client_state->SetDouble( | 
| "commit_to_activate_duration_estimate_ms", | 
| client_->CommitToActivateDurationEstimate().InMillisecondsF()); | 
| -  state->EndDictionary(); | 
| -  return state; | 
| +  state->Set("client_state", client_state.release()); | 
| +  return state.PassAs<base::Value>(); | 
| } | 
|  | 
| bool Scheduler::CanCommitAndActivateBeforeDeadline() const { | 
| @@ -746,7 +741,7 @@ | 
| "time_left_after_drawing_ms", | 
| (begin_impl_frame_args_.deadline - estimated_draw_time).InMillisecondsF(), | 
| "state", | 
| -      AsValue()); | 
| +      ToTrace(this)); | 
|  | 
| return estimated_draw_time < begin_impl_frame_args_.deadline; | 
| } | 
|  |