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

Unified Diff: cc/scheduler/scheduler_state_machine.cc

Issue 184063002: cc: Change texture locking check point (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modify invariant condition Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/scheduler/scheduler_state_machine_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/scheduler_state_machine.cc
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
index e89eff4fcdcb261a43dd35cc7e7642d318613d9b..23d27b9a7523bfaeb18c80f5ea1fdf1ad3584aca 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -310,6 +310,11 @@ bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const {
if (PendingActivationsShouldBeForced())
return true;
+ // Impl thread should not draw anymore when texture is acquired by main thread
+ // because texture is controlled under main thread.
+ if (texture_state_ == LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD)
+ return true;
+
// Additional states where we should abort draws.
// Note: We don't force activation in these cases because doing so would
// result in checkerboarding on resize, becoming visible, etc.
@@ -324,11 +329,6 @@ bool SchedulerStateMachine::PendingActivationsShouldBeForced() const {
// These are all the cases where, if we do not force activations to make
// forward progress, we might deadlock with the main thread.
- // The impl thread cannot lock layer textures unless the pending
- // tree can be activated to unblock the commit.
- if (texture_state_ == LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD)
- return true;
-
// There is no output surface to trigger our activations.
if (output_surface_state_ == OUTPUT_SURFACE_LOST)
return true;
@@ -568,6 +568,11 @@ void SchedulerStateMachine::CheckInvariants() {
// timeout simultaneously.
DCHECK(!(forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW &&
readback_state_ == READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK));
+
+ // Main thread should never have the texture locked when there is a pending
+ // tree or active tree is not drawn for the first time.
+ if (has_pending_tree_ || active_tree_needs_first_draw_)
+ DCHECK(texture_state_ != LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD);
}
void SchedulerStateMachine::UpdateState(Action action) {
« no previous file with comments | « no previous file | cc/scheduler/scheduler_state_machine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698