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

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

Issue 1394263004: android webview: allow cc to fail hardware draw (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests compile but crash Created 5 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 | « cc/output/output_surface.h ('k') | cc/test/fake_output_surface.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_state_machine.h" 5 #include "cc/scheduler/scheduler_state_machine.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 did_perform_swap_in_last_draw_); 249 did_perform_swap_in_last_draw_);
250 state->EndDictionary(); 250 state->EndDictionary();
251 } 251 }
252 252
253 bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const { 253 bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const {
254 // Normally when |visible_| is false, pending activations will be forced and 254 // Normally when |visible_| is false, pending activations will be forced and
255 // draws will be aborted. However, when the embedder is Android WebView, 255 // draws will be aborted. However, when the embedder is Android WebView,
256 // software draws could be scheduled by the Android OS at any time and draws 256 // software draws could be scheduled by the Android OS at any time and draws
257 // should not be aborted in this case. 257 // should not be aborted in this case.
258 bool is_output_surface_lost = (output_surface_state_ == OUTPUT_SURFACE_NONE); 258 bool is_output_surface_lost = (output_surface_state_ == OUTPUT_SURFACE_NONE);
259 if (settings_.using_synchronous_renderer_compositor)
260 return is_output_surface_lost || !can_draw_;
261 259
262 // These are all the cases where we normally cannot or do not want to draw 260 // These are all the cases where we normally cannot or do not want to draw
263 // but, if needs_redraw_ is true and we do not draw to make forward progress, 261 // but, if needs_redraw_ is true and we do not draw to make forward progress,
264 // we might deadlock with the main thread. 262 // we might deadlock with the main thread.
265 // This should be a superset of PendingActivationsShouldBeForced() since 263 // This should be a superset of PendingActivationsShouldBeForced() since
266 // activation of the pending tree is blocked by drawing of the active tree and 264 // activation of the pending tree is blocked by drawing of the active tree and
267 // the main thread might be blocked on activation of the most recent commit. 265 // the main thread might be blocked on activation of the most recent commit.
268 return is_output_surface_lost || !can_draw_ || !visible_; 266 // Note deliverately not checking |visible_| here because |can_draw_| already
267 // incorporates |visible_| state.
268 // TODO(boliu): This contradicts comment above that
boliu 2015/10/09 18:09:51 Question for Brian: So this patch shoves resource
boliu 2015/10/09 18:39:53 This goes a bit deeper, since resourceless softwar
269 // PendingDrawsShouldBeAborted is a superset of
270 // PendingActivationsShouldBeForced.
271 return is_output_surface_lost || !can_draw_;
269 } 272 }
270 273
271 bool SchedulerStateMachine::PendingActivationsShouldBeForced() const { 274 bool SchedulerStateMachine::PendingActivationsShouldBeForced() const {
272 // There is no output surface to trigger our activations. 275 // There is no output surface to trigger our activations.
273 // If we do not force activations to make forward progress, we might deadlock 276 // If we do not force activations to make forward progress, we might deadlock
274 // with the main thread. 277 // with the main thread.
275 if (output_surface_state_ == OUTPUT_SURFACE_NONE) 278 if (output_surface_state_ == OUTPUT_SURFACE_NONE)
276 return true; 279 return true;
277 280
278 // If we're not visible, we should force activation. 281 // If we're not visible, we should force activation.
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 case OUTPUT_SURFACE_ACTIVE: 1106 case OUTPUT_SURFACE_ACTIVE:
1104 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: 1107 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT:
1105 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: 1108 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION:
1106 return true; 1109 return true;
1107 } 1110 }
1108 NOTREACHED(); 1111 NOTREACHED();
1109 return false; 1112 return false;
1110 } 1113 }
1111 1114
1112 } // namespace cc 1115 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/output_surface.h ('k') | cc/test/fake_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698