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 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/profiler/scoped_tracker.h" | 11 #include "base/profiler/scoped_tracker.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "base/trace_event/trace_event_argument.h" | 14 #include "base/trace_event/trace_event_argument.h" |
15 #include "cc/debug/devtools_instrumentation.h" | 15 #include "cc/debug/devtools_instrumentation.h" |
16 #include "cc/debug/traced_value.h" | 16 #include "cc/debug/traced_value.h" |
17 #include "cc/scheduler/delay_based_time_source.h" | 17 #include "cc/scheduler/delay_based_time_source.h" |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 | 20 |
21 scoped_ptr<Scheduler> Scheduler::Create( | 21 scoped_ptr<Scheduler> Scheduler::Create( |
22 SchedulerClient* client, | 22 SchedulerClient* client, |
23 const SchedulerSettings& settings, | 23 const SchedulerSettings& settings, |
24 int layer_tree_host_id, | 24 int layer_tree_host_id, |
25 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 25 base::SingleThreadTaskRunner* task_runner, |
26 BeginFrameSource* external_frame_source) { | 26 BeginFrameSource* external_frame_source) { |
27 scoped_ptr<SyntheticBeginFrameSource> synthetic_frame_source; | 27 scoped_ptr<SyntheticBeginFrameSource> synthetic_frame_source; |
28 if (!settings.use_external_begin_frame_source) { | 28 if (!settings.use_external_begin_frame_source) { |
29 synthetic_frame_source = SyntheticBeginFrameSource::Create( | 29 synthetic_frame_source = SyntheticBeginFrameSource::Create( |
30 task_runner.get(), BeginFrameArgs::DefaultInterval()); | 30 task_runner, BeginFrameArgs::DefaultInterval()); |
31 } | 31 } |
32 scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source = | 32 scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source = |
33 BackToBackBeginFrameSource::Create(task_runner.get()); | 33 BackToBackBeginFrameSource::Create(task_runner); |
34 return make_scoped_ptr(new Scheduler( | 34 return make_scoped_ptr(new Scheduler( |
35 client, settings, layer_tree_host_id, task_runner, external_frame_source, | 35 client, settings, layer_tree_host_id, task_runner, external_frame_source, |
36 synthetic_frame_source.Pass(), unthrottled_frame_source.Pass())); | 36 synthetic_frame_source.Pass(), unthrottled_frame_source.Pass())); |
37 } | 37 } |
38 | 38 |
39 Scheduler::Scheduler( | 39 Scheduler::Scheduler( |
40 SchedulerClient* client, | 40 SchedulerClient* client, |
41 const SchedulerSettings& settings, | 41 const SchedulerSettings& settings, |
42 int layer_tree_host_id, | 42 int layer_tree_host_id, |
43 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 43 base::SingleThreadTaskRunner* task_runner, |
44 BeginFrameSource* external_frame_source, | 44 BeginFrameSource* external_frame_source, |
45 scoped_ptr<SyntheticBeginFrameSource> synthetic_frame_source, | 45 scoped_ptr<SyntheticBeginFrameSource> synthetic_frame_source, |
46 scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source) | 46 scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source) |
47 : settings_(settings), | 47 : settings_(settings), |
48 client_(client), | 48 client_(client), |
49 layer_tree_host_id_(layer_tree_host_id), | 49 layer_tree_host_id_(layer_tree_host_id), |
50 task_runner_(task_runner), | 50 task_runner_(task_runner), |
51 external_frame_source_(external_frame_source), | 51 external_frame_source_(external_frame_source), |
52 synthetic_frame_source_(synthetic_frame_source.Pass()), | 52 synthetic_frame_source_(synthetic_frame_source.Pass()), |
53 unthrottled_frame_source_(unthrottled_frame_source.Pass()), | 53 unthrottled_frame_source_(unthrottled_frame_source.Pass()), |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 } | 735 } |
736 | 736 |
737 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 737 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
738 return (state_machine_.commit_state() == | 738 return (state_machine_.commit_state() == |
739 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 739 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
740 state_machine_.commit_state() == | 740 state_machine_.commit_state() == |
741 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 741 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
742 } | 742 } |
743 | 743 |
744 } // namespace cc | 744 } // namespace cc |
OLD | NEW |