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

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

Issue 23495022: CC: Add a scheduled action for ManageTiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use frame count instead of begin-frame throttling Created 7 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
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 #include "cc/debug/traced_value.h" 10 #include "cc/debug/traced_value.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 Scheduler::Scheduler(SchedulerClient* client, 14 Scheduler::Scheduler(SchedulerClient* client,
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 weak_factory_(this), 18 weak_factory_(this),
19 last_set_needs_begin_frame_(false), 19 last_set_needs_begin_frame_(false),
20 has_pending_begin_frame_(false), 20 has_pending_begin_frame_(false),
21 state_machine_(scheduler_settings), 21 state_machine_(scheduler_settings),
22 inside_process_scheduled_actions_(false) { 22 inside_process_scheduled_actions_(false),
23 inside_action_(SchedulerStateMachine::ACTION_NONE) {
23 DCHECK(client_); 24 DCHECK(client_);
24 DCHECK(!state_machine_.BeginFrameNeededToDrawByImplThread()); 25 DCHECK(!state_machine_.BeginFrameNeededToDrawByImplThread());
25 } 26 }
26 27
27 Scheduler::~Scheduler() { 28 Scheduler::~Scheduler() {
28 client_->SetNeedsBeginFrameOnImplThread(false); 29 client_->SetNeedsBeginFrameOnImplThread(false);
29 } 30 }
30 31
31 void Scheduler::SetCanStart() { 32 void Scheduler::SetCanStart() {
32 state_machine_.SetCanStart(); 33 state_machine_.SetCanStart();
(...skipping 24 matching lines...) Expand all
57 state_machine_.SetNeedsCommit(); 58 state_machine_.SetNeedsCommit();
58 state_machine_.SetNeedsForcedCommitForReadback(); 59 state_machine_.SetNeedsForcedCommitForReadback();
59 ProcessScheduledActions(); 60 ProcessScheduledActions();
60 } 61 }
61 62
62 void Scheduler::SetNeedsRedraw() { 63 void Scheduler::SetNeedsRedraw() {
63 state_machine_.SetNeedsRedraw(); 64 state_machine_.SetNeedsRedraw();
64 ProcessScheduledActions(); 65 ProcessScheduledActions();
65 } 66 }
66 67
68 void Scheduler::SetNeedsManageTiles() {
69 DCHECK(!IsInsideAction(SchedulerStateMachine::ACTION_MANAGE_TILES));
brianderson 2013/09/13 00:29:00 How does ManagingTiles result in SetNeedsManageTil
epennerAtGoogle 2013/09/13 00:37:56 We don't do it. This is just meant to insure we ne
brianderson 2013/09/13 00:42:34 Ah, I completely miss read the code. I really lik
70 state_machine_.SetNeedsManageTiles();
71 ProcessScheduledActions();
72 }
73
67 void Scheduler::SetSwapUsedIncompleteTile(bool used_incomplete_tile) { 74 void Scheduler::SetSwapUsedIncompleteTile(bool used_incomplete_tile) {
68 state_machine_.SetSwapUsedIncompleteTile(used_incomplete_tile); 75 state_machine_.SetSwapUsedIncompleteTile(used_incomplete_tile);
69 ProcessScheduledActions(); 76 ProcessScheduledActions();
70 } 77 }
71 78
72 void Scheduler::SetMainThreadNeedsLayerTextures() { 79 void Scheduler::SetMainThreadNeedsLayerTextures() {
73 state_machine_.SetMainThreadNeedsLayerTextures(); 80 state_machine_.SetMainThreadNeedsLayerTextures();
74 ProcessScheduledActions(); 81 ProcessScheduledActions();
75 } 82 }
76 83
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 223
217 SchedulerStateMachine::Action action; 224 SchedulerStateMachine::Action action;
218 do { 225 do {
219 state_machine_.CheckInvariants(); 226 state_machine_.CheckInvariants();
220 action = state_machine_.NextAction(); 227 action = state_machine_.NextAction();
221 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), 228 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"),
222 "SchedulerStateMachine", 229 "SchedulerStateMachine",
223 "state", 230 "state",
224 TracedValue::FromValue(state_machine_.AsValue().release())); 231 TracedValue::FromValue(state_machine_.AsValue().release()));
225 state_machine_.UpdateState(action); 232 state_machine_.UpdateState(action);
233 base::AutoReset<SchedulerStateMachine::Action>
234 mark_inside_action(&inside_action_, action);
enne (OOO) 2013/09/13 00:47:01 Nifty!
226 switch (action) { 235 switch (action) {
227 case SchedulerStateMachine::ACTION_NONE: 236 case SchedulerStateMachine::ACTION_NONE:
228 break; 237 break;
229 case SchedulerStateMachine::ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD: 238 case SchedulerStateMachine::ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD:
230 client_->ScheduledActionSendBeginFrameToMainThread(); 239 client_->ScheduledActionSendBeginFrameToMainThread();
231 break; 240 break;
232 case SchedulerStateMachine::ACTION_COMMIT: 241 case SchedulerStateMachine::ACTION_COMMIT:
233 client_->ScheduledActionCommit(); 242 client_->ScheduledActionCommit();
234 break; 243 break;
235 case SchedulerStateMachine::ACTION_UPDATE_VISIBLE_TILES: 244 case SchedulerStateMachine::ACTION_UPDATE_VISIBLE_TILES:
(...skipping 14 matching lines...) Expand all
250 break; 259 break;
251 case SchedulerStateMachine::ACTION_DRAW_AND_READBACK: 260 case SchedulerStateMachine::ACTION_DRAW_AND_READBACK:
252 DrawAndReadback(); 261 DrawAndReadback();
253 break; 262 break;
254 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: 263 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION:
255 client_->ScheduledActionBeginOutputSurfaceCreation(); 264 client_->ScheduledActionBeginOutputSurfaceCreation();
256 break; 265 break;
257 case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: 266 case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD:
258 client_->ScheduledActionAcquireLayerTexturesForMainThread(); 267 client_->ScheduledActionAcquireLayerTexturesForMainThread();
259 break; 268 break;
269 case SchedulerStateMachine::ACTION_MANAGE_TILES:
270 client_->ScheduledActionManageTiles();
271 break;
260 } 272 }
261 } while (action != SchedulerStateMachine::ACTION_NONE); 273 } while (action != SchedulerStateMachine::ACTION_NONE);
262 274
263 SetupNextBeginFrameIfNeeded(); 275 SetupNextBeginFrameIfNeeded();
264 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); 276 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime());
265 } 277 }
266 278
267 bool Scheduler::WillDrawIfNeeded() const { 279 bool Scheduler::WillDrawIfNeeded() const {
268 return !state_machine_.PendingDrawsShouldBeAborted(); 280 return !state_machine_.PendingDrawsShouldBeAborted();
269 } 281 }
270 282
271 } // namespace cc 283 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698