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

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

Issue 15058004: cc: Rename VSync to BeginFrame (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix test compiler errors Created 7 years, 7 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
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 "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 Scheduler::Scheduler(SchedulerClient* client, 13 Scheduler::Scheduler(SchedulerClient* client,
14 scoped_ptr<FrameRateController> frame_rate_controller, 14 scoped_ptr<FrameRateController> frame_rate_controller,
15 const SchedulerSettings& scheduler_settings) 15 const SchedulerSettings& scheduler_settings)
16 : settings_(scheduler_settings), 16 : settings_(scheduler_settings),
17 client_(client), 17 client_(client),
18 frame_rate_controller_(frame_rate_controller.Pass()), 18 frame_rate_controller_(frame_rate_controller.Pass()),
19 state_machine_(scheduler_settings), 19 state_machine_(scheduler_settings),
20 inside_process_scheduled_actions_(false) { 20 inside_process_scheduled_actions_(false) {
21 DCHECK(client_); 21 DCHECK(client_);
22 frame_rate_controller_->SetClient(this); 22 frame_rate_controller_->SetClient(this);
23 DCHECK(!state_machine_.VSyncCallbackNeeded()); 23 DCHECK(!state_machine_.BeginFrameCallbackNeeded());
24 } 24 }
25 25
26 Scheduler::~Scheduler() { frame_rate_controller_->SetActive(false); } 26 Scheduler::~Scheduler() { frame_rate_controller_->SetActive(false); }
27 27
28 void Scheduler::SetCanStart() { 28 void Scheduler::SetCanStart() {
29 state_machine_.SetCanStart(); 29 state_machine_.SetCanStart();
30 ProcessScheduledActions(); 30 ProcessScheduledActions();
31 } 31 }
32 32
33 void Scheduler::SetVisible(bool visible) { 33 void Scheduler::SetVisible(bool visible) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 void Scheduler::SetTimebaseAndInterval(base::TimeTicks timebase, 125 void Scheduler::SetTimebaseAndInterval(base::TimeTicks timebase,
126 base::TimeDelta interval) { 126 base::TimeDelta interval) {
127 frame_rate_controller_->SetTimebaseAndInterval(timebase, interval); 127 frame_rate_controller_->SetTimebaseAndInterval(timebase, interval);
128 } 128 }
129 129
130 base::TimeTicks Scheduler::AnticipatedDrawTime() { 130 base::TimeTicks Scheduler::AnticipatedDrawTime() {
131 return frame_rate_controller_->NextTickTime(); 131 return frame_rate_controller_->NextTickTime();
132 } 132 }
133 133
134 base::TimeTicks Scheduler::LastVSyncTime() { 134 base::TimeTicks Scheduler::LastBeginFrameTime() {
135 return frame_rate_controller_->LastTickTime(); 135 return frame_rate_controller_->LastTickTime();
136 } 136 }
137 137
138 void Scheduler::VSyncTick(bool throttled) { 138 void Scheduler::BeginFrame(bool throttled) {
139 TRACE_EVENT1("cc", "Scheduler::VSyncTick", "throttled", throttled); 139 TRACE_EVENT1("cc", "Scheduler::BeginFrame", "throttled", throttled);
140 if (!throttled) 140 if (!throttled)
141 state_machine_.DidEnterVSync(); 141 state_machine_.DidEnterBeginFrame();
142 ProcessScheduledActions(); 142 ProcessScheduledActions();
143 if (!throttled) 143 if (!throttled)
144 state_machine_.DidLeaveVSync(); 144 state_machine_.DidLeaveBeginFrame();
145 } 145 }
146 146
147 void Scheduler::ProcessScheduledActions() { 147 void Scheduler::ProcessScheduledActions() {
148 // We do not allow ProcessScheduledActions to be recursive. 148 // We do not allow ProcessScheduledActions to be recursive.
149 // The top-level call will iteratively execute the next action for us anyway. 149 // The top-level call will iteratively execute the next action for us anyway.
150 if (inside_process_scheduled_actions_) 150 if (inside_process_scheduled_actions_)
151 return; 151 return;
152 152
153 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); 153 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true);
154 154
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 client_->ScheduledActionBeginOutputSurfaceCreation(); 192 client_->ScheduledActionBeginOutputSurfaceCreation();
193 break; 193 break;
194 case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: 194 case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD:
195 client_->ScheduledActionAcquireLayerTexturesForMainThread(); 195 client_->ScheduledActionAcquireLayerTexturesForMainThread();
196 break; 196 break;
197 } 197 }
198 action = state_machine_.NextAction(); 198 action = state_machine_.NextAction();
199 } 199 }
200 200
201 // Activate or deactivate the frame rate controller. 201 // Activate or deactivate the frame rate controller.
202 frame_rate_controller_->SetActive(state_machine_.VSyncCallbackNeeded()); 202 frame_rate_controller_->SetActive(state_machine_.BeginFrameCallbackNeeded());
203 client_->DidAnticipatedDrawTimeChange(frame_rate_controller_->NextTickTime()); 203 client_->DidAnticipatedDrawTimeChange(frame_rate_controller_->NextTickTime());
204 } 204 }
205 205
206 bool Scheduler::WillDrawIfNeeded() const { 206 bool Scheduler::WillDrawIfNeeded() const {
207 return !state_machine_.DrawSuspendedUntilCommit(); 207 return !state_machine_.DrawSuspendedUntilCommit();
208 } 208 }
209 209
210 } // namespace cc 210 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698