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

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

Issue 199523002: cc: Throttle swaps in Scheduler instead of OutputSurface (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: dana's comments Created 6 years, 8 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 <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"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 state_machine_.SetNeedsRedraw(); 85 state_machine_.SetNeedsRedraw();
86 ProcessScheduledActions(); 86 ProcessScheduledActions();
87 } 87 }
88 88
89 void Scheduler::SetNeedsManageTiles() { 89 void Scheduler::SetNeedsManageTiles() {
90 DCHECK(!IsInsideAction(SchedulerStateMachine::ACTION_MANAGE_TILES)); 90 DCHECK(!IsInsideAction(SchedulerStateMachine::ACTION_MANAGE_TILES));
91 state_machine_.SetNeedsManageTiles(); 91 state_machine_.SetNeedsManageTiles();
92 ProcessScheduledActions(); 92 ProcessScheduledActions();
93 } 93 }
94 94
95 void Scheduler::SetMaxSwapsPending(int max) {
96 state_machine_.SetMaxSwapsPending(max);
97 }
98
99 void Scheduler::DidSwapBuffers() {
100 state_machine_.DidSwapBuffers();
101 // There is no need to call ProcessScheduledActions here because
102 // swapping should not trigger any new actions.
danakj 2014/04/14 18:14:51 Can we DCHECK that state_machine_.NextAction() is
brianderson 2014/04/16 22:41:53 We are most likely already in a ProcessScheduledAc
103 }
104
95 void Scheduler::SetSwapUsedIncompleteTile(bool used_incomplete_tile) { 105 void Scheduler::SetSwapUsedIncompleteTile(bool used_incomplete_tile) {
96 state_machine_.SetSwapUsedIncompleteTile(used_incomplete_tile); 106 state_machine_.SetSwapUsedIncompleteTile(used_incomplete_tile);
97 ProcessScheduledActions(); 107 ProcessScheduledActions();
98 } 108 }
99 109
110 void Scheduler::DidSwapBuffersComplete() {
111 state_machine_.DidSwapBuffersComplete();
112 ProcessScheduledActions();
113 }
114
100 void Scheduler::SetSmoothnessTakesPriority(bool smoothness_takes_priority) { 115 void Scheduler::SetSmoothnessTakesPriority(bool smoothness_takes_priority) {
101 state_machine_.SetSmoothnessTakesPriority(smoothness_takes_priority); 116 state_machine_.SetSmoothnessTakesPriority(smoothness_takes_priority);
102 ProcessScheduledActions(); 117 ProcessScheduledActions();
103 } 118 }
104 119
105 void Scheduler::NotifyReadyToCommit() { 120 void Scheduler::NotifyReadyToCommit() {
106 TRACE_EVENT0("cc", "Scheduler::NotifyReadyToCommit"); 121 TRACE_EVENT0("cc", "Scheduler::NotifyReadyToCommit");
107 state_machine_.NotifyReadyToCommit(); 122 state_machine_.NotifyReadyToCommit();
108 ProcessScheduledActions(); 123 ProcessScheduledActions();
109 } 124 }
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 client_->ScheduledActionDrawAndSwapIfPossible(); 441 client_->ScheduledActionDrawAndSwapIfPossible();
427 state_machine_.DidDrawIfPossibleCompleted(result.draw_result); 442 state_machine_.DidDrawIfPossibleCompleted(result.draw_result);
428 } 443 }
429 444
430 void Scheduler::DrawAndSwapForced() { 445 void Scheduler::DrawAndSwapForced() {
431 client_->ScheduledActionDrawAndSwapForced(); 446 client_->ScheduledActionDrawAndSwapForced();
432 } 447 }
433 448
434 void Scheduler::DrawAndReadback() { 449 void Scheduler::DrawAndReadback() {
435 DrawSwapReadbackResult result = client_->ScheduledActionDrawAndReadback(); 450 DrawSwapReadbackResult result = client_->ScheduledActionDrawAndReadback();
436 DCHECK(!result.did_swap); 451 DCHECK(!result.did_request_swap);
437 } 452 }
438 453
439 void Scheduler::ProcessScheduledActions() { 454 void Scheduler::ProcessScheduledActions() {
440 // We do not allow ProcessScheduledActions to be recursive. 455 // We do not allow ProcessScheduledActions to be recursive.
441 // The top-level call will iteratively execute the next action for us anyway. 456 // The top-level call will iteratively execute the next action for us anyway.
442 if (inside_process_scheduled_actions_) 457 if (inside_process_scheduled_actions_)
443 return; 458 return;
444 459
445 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); 460 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true);
446 461
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 } 571 }
557 572
558 bool Scheduler::IsBeginMainFrameSentOrStarted() const { 573 bool Scheduler::IsBeginMainFrameSentOrStarted() const {
559 return (state_machine_.commit_state() == 574 return (state_machine_.commit_state() ==
560 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || 575 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT ||
561 state_machine_.commit_state() == 576 state_machine_.commit_state() ==
562 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); 577 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED);
563 } 578 }
564 579
565 } // namespace cc 580 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698