cc: Add trace events for the Scheduler states.
With upcoming scheduler changes, it'll be easier to understand the
scheduler if there's a tracing option for the scheduler state.
Given how much state there is to trace, a new disabled-by-default
tracing category is used called "cc.debug.scheduler".
BUG=276637
Review URL: https://chromiumcodereview.appspot.com/22802018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218686 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index 010cc99..0cf594f 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -7,6 +7,7 @@
#include "base/auto_reset.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
+#include "cc/debug/traced_value.h"
namespace cc {
@@ -199,8 +200,13 @@
base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true);
- SchedulerStateMachine::Action action = state_machine_.NextAction();
- while (action != SchedulerStateMachine::ACTION_NONE) {
+ SchedulerStateMachine::Action action;
+ do {
+ action = state_machine_.NextAction();
+ TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"),
+ "SchedulerStateMachine",
+ "state",
+ TracedValue::FromValue(state_machine_.AsValue().release()));
state_machine_.UpdateState(action);
switch (action) {
case SchedulerStateMachine::ACTION_NONE:
@@ -230,8 +236,7 @@
client_->ScheduledActionAcquireLayerTexturesForMainThread();
break;
}
- action = state_machine_.NextAction();
- }
+ } while (action != SchedulerStateMachine::ACTION_NONE);
SetupNextBeginFrameIfNeeded();
client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime());