OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/scheduler/scheduler.h" | 5 #include "cc/scheduler/scheduler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "cc/debug/devtools_instrumentation.h" | 11 #include "cc/debug/devtools_instrumentation.h" |
12 #include "cc/debug/traced_value.h" | 12 #include "cc/debug/traced_value.h" |
13 #include "ui/gfx/frame_time.h" | 13 #include "ui/gfx/frame_time.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 Scheduler::Scheduler(SchedulerClient* client, | 17 Scheduler::Scheduler(SchedulerClient* client, |
18 const SchedulerSettings& scheduler_settings, | 18 const SchedulerSettings& scheduler_settings, |
19 int layer_tree_host_id) | 19 int layer_tree_host_id) |
20 : settings_(scheduler_settings), | 20 : settings_(scheduler_settings), |
21 client_(client), | 21 client_(client), |
22 layer_tree_host_id_(layer_tree_host_id), | 22 layer_tree_host_id_(layer_tree_host_id), |
23 last_set_needs_begin_impl_frame_(false), | 23 last_set_needs_begin_impl_frame_(false), |
24 state_machine_(scheduler_settings), | 24 state_machine_(scheduler_settings), |
25 inside_process_scheduled_actions_(false), | 25 inside_process_scheduled_actions_(false), |
26 inside_action_(SchedulerStateMachine::ACTION_NONE), | 26 inside_action_(SchedulerStateMachine::ACTION_NONE), |
27 weak_factory_(this) { | 27 weak_factory_(this) { |
28 DCHECK(client_); | 28 DCHECK(client_); |
29 DCHECK(!state_machine_.BeginImplFrameNeeded()); | 29 DCHECK(!state_machine_.BeginImplFrameNeeded()); |
| 30 if (settings_.start_commit_before_activate_enabled) { |
| 31 DCHECK(settings_.start_commit_before_draw_enabled); |
| 32 } |
30 } | 33 } |
31 | 34 |
32 Scheduler::~Scheduler() {} | 35 Scheduler::~Scheduler() {} |
33 | 36 |
34 void Scheduler::SetCanStart() { | 37 void Scheduler::SetCanStart() { |
35 state_machine_.SetCanStart(); | 38 state_machine_.SetCanStart(); |
36 ProcessScheduledActions(); | 39 ProcessScheduledActions(); |
37 } | 40 } |
38 | 41 |
39 void Scheduler::SetVisible(bool visible) { | 42 void Scheduler::SetVisible(bool visible) { |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 // impl thread's deadline. | 384 // impl thread's deadline. |
382 base::TimeTicks estimated_draw_time = | 385 base::TimeTicks estimated_draw_time = |
383 last_begin_impl_frame_args_.frame_time + | 386 last_begin_impl_frame_args_.frame_time + |
384 client_->BeginMainFrameToCommitDurationEstimate() + | 387 client_->BeginMainFrameToCommitDurationEstimate() + |
385 client_->CommitToActivateDurationEstimate(); | 388 client_->CommitToActivateDurationEstimate(); |
386 | 389 |
387 return estimated_draw_time < last_begin_impl_frame_args_.deadline; | 390 return estimated_draw_time < last_begin_impl_frame_args_.deadline; |
388 } | 391 } |
389 | 392 |
390 } // namespace cc | 393 } // namespace cc |
OLD | NEW |