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

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

Issue 605823002: cc: Activate when going invisible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 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 | « no previous file | 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_state_machine.h" 5 #include "cc/scheduler/scheduler_state_machine.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/debug/trace_event_argument.h" 8 #include "base/debug/trace_event_argument.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // These are all the cases where we normally cannot or do not want to draw 275 // These are all the cases where we normally cannot or do not want to draw
276 // but, if needs_redraw_ is true and we do not draw to make forward progress, 276 // but, if needs_redraw_ is true and we do not draw to make forward progress,
277 // we might deadlock with the main thread. 277 // we might deadlock with the main thread.
278 // This should be a superset of PendingActivationsShouldBeForced() since 278 // This should be a superset of PendingActivationsShouldBeForced() since
279 // activation of the pending tree is blocked by drawing of the active tree and 279 // activation of the pending tree is blocked by drawing of the active tree and
280 // the main thread might be blocked on activation of the most recent commit. 280 // the main thread might be blocked on activation of the most recent commit.
281 if (PendingActivationsShouldBeForced()) 281 if (PendingActivationsShouldBeForced())
282 return true; 282 return true;
283 283
284 // Additional states where we should abort draws. 284 // Additional states where we should abort draws.
285 // Note: We don't force activation in these cases because doing so would
286 // result in checkerboarding on resize, becoming visible, etc.
287 if (!can_draw_) 285 if (!can_draw_)
288 return true; 286 return true;
289 if (!visible_)
290 return true;
291 return false; 287 return false;
292 } 288 }
293 289
294 bool SchedulerStateMachine::PendingActivationsShouldBeForced() const { 290 bool SchedulerStateMachine::PendingActivationsShouldBeForced() const {
295 // These are all the cases where, if we do not force activations to make 291 // There is no output surface to trigger our activations.
296 // forward progress, we might deadlock with the main thread. 292 // If we do not force activations to make forward progress, we might deadlock
293 // with the main thread.
294 if (output_surface_state_ == OUTPUT_SURFACE_LOST)
295 return true;
297 296
298 // There is no output surface to trigger our activations. 297 // If we're not visible, we should force activation.
299 if (output_surface_state_ == OUTPUT_SURFACE_LOST) 298 // Since we set RequiresHighResToDraw when becoming visible, we ensure that we
299 // don't checkerboard until all visible resources are done. Furthermore, if we
300 // do keep the pending tree around, when becoming visible we might activate
301 // prematurely causing RequiresHighResToDraw flag to be reset. In all cases,
302 // we can simply activate on becoming invisible since we don't need to draw
303 // the active tree when we're in this state.
304 if (!visible_)
300 return true; 305 return true;
301 306
302 return false; 307 return false;
303 } 308 }
304 309
305 bool SchedulerStateMachine::ShouldBeginOutputSurfaceCreation() const { 310 bool SchedulerStateMachine::ShouldBeginOutputSurfaceCreation() const {
306 // Don't try to initialize too early. 311 // Don't try to initialize too early.
307 if (!can_start_) 312 if (!can_start_)
308 return false; 313 return false;
309 314
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 static_cast<int>(begin_impl_frame_state_), 1102 static_cast<int>(begin_impl_frame_state_),
1098 static_cast<int>(commit_state_), 1103 static_cast<int>(commit_state_),
1099 has_pending_tree_ ? 'T' : 'F', 1104 has_pending_tree_ ? 'T' : 'F',
1100 pending_tree_is_ready_for_activation_ ? 'T' : 'F', 1105 pending_tree_is_ready_for_activation_ ? 'T' : 'F',
1101 active_tree_needs_first_draw_ ? 'T' : 'F', 1106 active_tree_needs_first_draw_ ? 'T' : 'F',
1102 max_pending_swaps_, 1107 max_pending_swaps_,
1103 pending_swaps_); 1108 pending_swaps_);
1104 } 1109 }
1105 1110
1106 } // namespace cc 1111 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698