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

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: Actually, unittests need CC_EXPORT. 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
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_state_machine.h » ('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 #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.
103 if (!inside_process_scheduled_actions_) {
104 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE);
105 }
106 }
107
95 void Scheduler::SetSwapUsedIncompleteTile(bool used_incomplete_tile) { 108 void Scheduler::SetSwapUsedIncompleteTile(bool used_incomplete_tile) {
96 state_machine_.SetSwapUsedIncompleteTile(used_incomplete_tile); 109 state_machine_.SetSwapUsedIncompleteTile(used_incomplete_tile);
97 ProcessScheduledActions(); 110 ProcessScheduledActions();
98 } 111 }
99 112
113 void Scheduler::DidSwapBuffersComplete() {
114 state_machine_.DidSwapBuffersComplete();
115 ProcessScheduledActions();
116 }
117
100 void Scheduler::SetSmoothnessTakesPriority(bool smoothness_takes_priority) { 118 void Scheduler::SetSmoothnessTakesPriority(bool smoothness_takes_priority) {
101 state_machine_.SetSmoothnessTakesPriority(smoothness_takes_priority); 119 state_machine_.SetSmoothnessTakesPriority(smoothness_takes_priority);
102 ProcessScheduledActions(); 120 ProcessScheduledActions();
103 } 121 }
104 122
105 void Scheduler::NotifyReadyToCommit() { 123 void Scheduler::NotifyReadyToCommit() {
106 TRACE_EVENT0("cc", "Scheduler::NotifyReadyToCommit"); 124 TRACE_EVENT0("cc", "Scheduler::NotifyReadyToCommit");
107 state_machine_.NotifyReadyToCommit(); 125 state_machine_.NotifyReadyToCommit();
108 ProcessScheduledActions(); 126 ProcessScheduledActions();
109 } 127 }
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 client_->ScheduledActionDrawAndSwapIfPossible(); 444 client_->ScheduledActionDrawAndSwapIfPossible();
427 state_machine_.DidDrawIfPossibleCompleted(result.draw_result); 445 state_machine_.DidDrawIfPossibleCompleted(result.draw_result);
428 } 446 }
429 447
430 void Scheduler::DrawAndSwapForced() { 448 void Scheduler::DrawAndSwapForced() {
431 client_->ScheduledActionDrawAndSwapForced(); 449 client_->ScheduledActionDrawAndSwapForced();
432 } 450 }
433 451
434 void Scheduler::DrawAndReadback() { 452 void Scheduler::DrawAndReadback() {
435 DrawSwapReadbackResult result = client_->ScheduledActionDrawAndReadback(); 453 DrawSwapReadbackResult result = client_->ScheduledActionDrawAndReadback();
436 DCHECK(!result.did_swap); 454 DCHECK(!result.did_request_swap);
437 } 455 }
438 456
439 void Scheduler::ProcessScheduledActions() { 457 void Scheduler::ProcessScheduledActions() {
440 // We do not allow ProcessScheduledActions to be recursive. 458 // We do not allow ProcessScheduledActions to be recursive.
441 // The top-level call will iteratively execute the next action for us anyway. 459 // The top-level call will iteratively execute the next action for us anyway.
442 if (inside_process_scheduled_actions_) 460 if (inside_process_scheduled_actions_)
443 return; 461 return;
444 462
445 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); 463 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true);
446 464
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 } 574 }
557 575
558 bool Scheduler::IsBeginMainFrameSentOrStarted() const { 576 bool Scheduler::IsBeginMainFrameSentOrStarted() const {
559 return (state_machine_.commit_state() == 577 return (state_machine_.commit_state() ==
560 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || 578 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT ||
561 state_machine_.commit_state() == 579 state_machine_.commit_state() ==
562 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); 580 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED);
563 } 581 }
564 582
565 } // namespace cc 583 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_state_machine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698