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

Unified Diff: cc/scheduler/scheduler.cc

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_state_machine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/scheduler.cc
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index 904a0574515dac727b021f59386a721a0bb2f3c7..70d726d42bc971026ecd426e82c29e4697fd744e 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -8,6 +8,7 @@
#include "base/auto_reset.h"
#include "base/logging.h"
+#include "base/profiler/scoped_tracker.h"
#include "base/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_argument.h"
@@ -78,7 +79,6 @@ Scheduler::Scheduler(
const SchedulerSettings& scheduler_settings,
int layer_tree_host_id,
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
- base::PowerMonitor* power_monitor,
scoped_ptr<BeginFrameSource> external_begin_frame_source,
SchedulerFrameSourcesConstructor* frame_sources_constructor)
: frame_source_(),
@@ -92,7 +92,6 @@ Scheduler::Scheduler(
client_(client),
layer_tree_host_id_(layer_tree_host_id),
task_runner_(task_runner),
- power_monitor_(power_monitor),
state_machine_(scheduler_settings),
inside_process_scheduled_actions_(false),
inside_action_(SchedulerStateMachine::ACTION_NONE),
@@ -131,12 +130,9 @@ Scheduler::Scheduler(
unthrottled_frame_source_ =
frame_sources_constructor->ConstructUnthrottledFrameSource(this);
frame_source_->AddSource(unthrottled_frame_source_);
-
- SetupPowerMonitoring();
}
Scheduler::~Scheduler() {
- TeardownPowerMonitoring();
if (frame_source_->NeedsBeginFrames())
frame_source_->SetNeedsBeginFrames(false);
}
@@ -150,27 +146,6 @@ base::TimeTicks Scheduler::Now() const {
return now;
}
-void Scheduler::SetupPowerMonitoring() {
- if (settings_.disable_hi_res_timer_tasks_on_battery) {
- DCHECK(power_monitor_);
- power_monitor_->AddObserver(this);
- state_machine_.SetImplLatencyTakesPriorityOnBattery(
- power_monitor_->IsOnBatteryPower());
- }
-}
-
-void Scheduler::TeardownPowerMonitoring() {
- if (settings_.disable_hi_res_timer_tasks_on_battery) {
- DCHECK(power_monitor_);
- power_monitor_->RemoveObserver(this);
- }
-}
-
-void Scheduler::OnPowerStateChange(bool on_battery_power) {
- DCHECK(settings_.disable_hi_res_timer_tasks_on_battery);
- state_machine_.SetImplLatencyTakesPriorityOnBattery(on_battery_power);
-}
-
void Scheduler::CommitVSyncParameters(base::TimeTicks timebase,
base::TimeDelta interval) {
// TODO(brianderson): We should not be receiving 0 intervals.
@@ -647,11 +622,25 @@ void Scheduler::OnBeginImplFrameDeadline() {
// order to wait for more user-input before starting the next commit.
// * Creating a new OuputSurface will not occur during the deadline in
// order to allow the state machine to "settle" first.
+
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is fixed.
+ tracked_objects::ScopedTracker tracking_profile1(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::OnBeginImplFrameDeadline1"));
state_machine_.OnBeginImplFrameDeadline();
ProcessScheduledActions();
+
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is fixed.
+ tracked_objects::ScopedTracker tracking_profile2(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::OnBeginImplFrameDeadline2"));
state_machine_.OnBeginImplFrameIdle();
ProcessScheduledActions();
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is fixed.
+ tracked_objects::ScopedTracker tracking_profile3(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::OnBeginImplFrameDeadline3"));
client_->DidBeginImplFrameDeadline();
}
@@ -692,6 +681,10 @@ void Scheduler::ProcessScheduledActions() {
SchedulerStateMachine::Action action;
do {
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is fixed.
+ tracked_objects::ScopedTracker tracking_profile1(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::ProcessScheduledActions1"));
action = state_machine_.NextAction();
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"),
"SchedulerStateMachine",
@@ -706,40 +699,96 @@ void Scheduler::ProcessScheduledActions() {
switch (action) {
case SchedulerStateMachine::ACTION_NONE:
break;
- case SchedulerStateMachine::ACTION_ANIMATE:
+ case SchedulerStateMachine::ACTION_ANIMATE: {
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
+ // fixed.
+ tracked_objects::ScopedTracker tracking_profile2(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::ProcessScheduledActions2"));
client_->ScheduledActionAnimate();
break;
- case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
+ }
+ case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: {
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
+ // fixed.
+ tracked_objects::ScopedTracker tracking_profile3(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::ProcessScheduledActions3"));
client_->ScheduledActionSendBeginMainFrame();
break;
- case SchedulerStateMachine::ACTION_COMMIT:
+ }
+ case SchedulerStateMachine::ACTION_COMMIT: {
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
+ // fixed.
+ tracked_objects::ScopedTracker tracking_profile4(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::ProcessScheduledActions4"));
client_->ScheduledActionCommit();
break;
- case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE:
+ }
+ case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: {
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
+ // fixed.
+ tracked_objects::ScopedTracker tracking_profile5(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::ProcessScheduledActions5"));
client_->ScheduledActionActivateSyncTree();
break;
- case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE:
+ }
+ case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: {
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
+ // fixed.
+ tracked_objects::ScopedTracker tracking_profile6(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::ProcessScheduledActions6"));
DrawAndSwapIfPossible();
break;
- case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED:
+ }
+ case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED: {
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
+ // fixed.
+ tracked_objects::ScopedTracker tracking_profile7(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::ProcessScheduledActions7"));
client_->ScheduledActionDrawAndSwapForced();
break;
+ }
case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT:
// No action is actually performed, but this allows the state machine to
// advance out of its waiting to draw state without actually drawing.
break;
- case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION:
+ case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: {
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
+ // fixed.
+ tracked_objects::ScopedTracker tracking_profile8(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::ProcessScheduledActions8"));
client_->ScheduledActionBeginOutputSurfaceCreation();
break;
- case SchedulerStateMachine::ACTION_PREPARE_TILES:
+ }
+ case SchedulerStateMachine::ACTION_PREPARE_TILES: {
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
+ // fixed.
+ tracked_objects::ScopedTracker tracking_profile9(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::ProcessScheduledActions9"));
client_->ScheduledActionPrepareTiles();
break;
+ }
}
} while (action != SchedulerStateMachine::ACTION_NONE);
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is fixed.
+ tracked_objects::ScopedTracker tracking_profile10(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::ProcessScheduledActions10"));
SetupNextBeginFrameIfNeeded();
client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime());
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is fixed.
+ tracked_objects::ScopedTracker tracking_profile11(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::ProcessScheduledActions11"));
RescheduleBeginImplFrameDeadlineIfNeeded();
}
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_state_machine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698