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

Side by Side Diff: cc/scheduler/scheduler.cc

Issue 2324273002: Remove external begin frame source parameter and settings (Closed)
Patch Set: Add back comment, remove more febfs includes Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/profiler/scoped_tracker.h" 12 #include "base/profiler/scoped_tracker.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "base/trace_event/trace_event_argument.h" 15 #include "base/trace_event/trace_event_argument.h"
16 #include "cc/debug/devtools_instrumentation.h" 16 #include "cc/debug/devtools_instrumentation.h"
17 #include "cc/debug/traced_value.h" 17 #include "cc/debug/traced_value.h"
18 #include "cc/scheduler/compositor_timing_history.h" 18 #include "cc/scheduler/compositor_timing_history.h"
19 #include "cc/scheduler/delay_based_time_source.h" 19 #include "cc/scheduler/delay_based_time_source.h"
20 20
21 namespace cc { 21 namespace cc {
22 22
23 namespace { 23 namespace {
24 // This is a fudge factor we subtract from the deadline to account 24 // This is a fudge factor we subtract from the deadline to account
25 // for message latency and kernel scheduling variability. 25 // for message latency and kernel scheduling variability.
26 const base::TimeDelta kDeadlineFudgeFactor = 26 const base::TimeDelta kDeadlineFudgeFactor =
27 base::TimeDelta::FromMicroseconds(1000); 27 base::TimeDelta::FromMicroseconds(1000);
28 } 28 }
29 29
30 std::unique_ptr<Scheduler> Scheduler::Create(
31 SchedulerClient* client,
32 const SchedulerSettings& settings,
33 int layer_tree_host_id,
34 base::SingleThreadTaskRunner* task_runner,
35 BeginFrameSource* begin_frame_source,
36 std::unique_ptr<CompositorTimingHistory> compositor_timing_history) {
37 return base::WrapUnique(new Scheduler(client, settings, layer_tree_host_id,
38 task_runner, begin_frame_source,
39 std::move(compositor_timing_history)));
40 }
41
42 Scheduler::Scheduler( 30 Scheduler::Scheduler(
43 SchedulerClient* client, 31 SchedulerClient* client,
44 const SchedulerSettings& settings, 32 const SchedulerSettings& settings,
45 int layer_tree_host_id, 33 int layer_tree_host_id,
46 base::SingleThreadTaskRunner* task_runner, 34 base::SingleThreadTaskRunner* task_runner,
47 BeginFrameSource* begin_frame_source,
48 std::unique_ptr<CompositorTimingHistory> compositor_timing_history) 35 std::unique_ptr<CompositorTimingHistory> compositor_timing_history)
49 : settings_(settings), 36 : settings_(settings),
50 client_(client), 37 client_(client),
51 layer_tree_host_id_(layer_tree_host_id), 38 layer_tree_host_id_(layer_tree_host_id),
52 task_runner_(task_runner), 39 task_runner_(task_runner),
53 begin_frame_source_(nullptr), 40 begin_frame_source_(nullptr),
54 observing_begin_frame_source_(false), 41 observing_begin_frame_source_(false),
55 compositor_timing_history_(std::move(compositor_timing_history)), 42 compositor_timing_history_(std::move(compositor_timing_history)),
56 begin_impl_frame_deadline_mode_( 43 begin_impl_frame_deadline_mode_(
57 SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_NONE), 44 SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_NONE),
58 begin_impl_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), 45 begin_impl_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE),
59 state_machine_(settings), 46 state_machine_(settings),
60 inside_process_scheduled_actions_(false), 47 inside_process_scheduled_actions_(false),
61 inside_action_(SchedulerStateMachine::ACTION_NONE), 48 inside_action_(SchedulerStateMachine::ACTION_NONE),
62 weak_factory_(this) { 49 weak_factory_(this) {
63 TRACE_EVENT1("cc", "Scheduler::Scheduler", "settings", settings_.AsValue()); 50 TRACE_EVENT1("cc", "Scheduler::Scheduler", "settings", settings_.AsValue());
64 DCHECK(client_); 51 DCHECK(client_);
65 DCHECK(!state_machine_.BeginFrameNeeded()); 52 DCHECK(!state_machine_.BeginFrameNeeded());
66 53
67 begin_retro_frame_closure_ = 54 begin_retro_frame_closure_ =
68 base::Bind(&Scheduler::BeginRetroFrame, weak_factory_.GetWeakPtr()); 55 base::Bind(&Scheduler::BeginRetroFrame, weak_factory_.GetWeakPtr());
69 begin_impl_frame_deadline_closure_ = base::Bind( 56 begin_impl_frame_deadline_closure_ = base::Bind(
70 &Scheduler::OnBeginImplFrameDeadline, weak_factory_.GetWeakPtr()); 57 &Scheduler::OnBeginImplFrameDeadline, weak_factory_.GetWeakPtr());
71 58
72 SetBeginFrameSource(begin_frame_source);
73 ProcessScheduledActions(); 59 ProcessScheduledActions();
74 } 60 }
75 61
76 Scheduler::~Scheduler() { 62 Scheduler::~Scheduler() {
77 SetBeginFrameSource(nullptr); 63 SetBeginFrameSource(nullptr);
78 } 64 }
79 65
80 base::TimeTicks Scheduler::Now() const { 66 base::TimeTicks Scheduler::Now() const {
81 base::TimeTicks now = base::TimeTicks::Now(); 67 base::TimeTicks now = base::TimeTicks::Now();
82 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.now"), 68 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.now"),
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 } 798 }
813 799
814 bool Scheduler::IsBeginMainFrameSentOrStarted() const { 800 bool Scheduler::IsBeginMainFrameSentOrStarted() const {
815 return (state_machine_.begin_main_frame_state() == 801 return (state_machine_.begin_main_frame_state() ==
816 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || 802 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT ||
817 state_machine_.begin_main_frame_state() == 803 state_machine_.begin_main_frame_state() ==
818 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); 804 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED);
819 } 805 }
820 806
821 } // namespace cc 807 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698