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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 23670002: cc: Handle deferred GL initialization failure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: handlefailure-deferredglinit: merge test setup code Created 7 years, 4 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/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 4fa325b8022594767120383faebad57142476637..5546ea33d36ce5773120089d2538164aaec607e9 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1681,19 +1681,49 @@ bool LayerTreeHostImpl::DeferredInitialize(
ReleaseTreeResources();
renderer_.reset();
- resource_provider_->InitializeGL();
- bool skip_gl_renderer = false;
- CreateAndSetRenderer(
- output_surface_.get(), resource_provider_.get(), skip_gl_renderer);
- bool success = !!renderer_.get();
+ bool resource_provider_success = resource_provider_->InitializeGL();
+
+ bool success = resource_provider_success;
+ if (success) {
+ bool skip_gl_renderer = false;
+ CreateAndSetRenderer(
+ output_surface_.get(), resource_provider_.get(), skip_gl_renderer);
+ if (!renderer_)
+ success = false;
+ }
+
+ if (success) {
+ if (offscreen_context_provider.get() &&
+ !offscreen_context_provider->BindToCurrentThread())
+ success = false;
+ }
+
if (success) {
EnforceZeroBudget(false);
client_->SetNeedsCommitOnImplThread();
- } else if (offscreen_context_provider.get()) {
- if (offscreen_context_provider->BindToCurrentThread())
- offscreen_context_provider->VerifyContexts();
- offscreen_context_provider = NULL;
+ } else {
+ if (offscreen_context_provider.get()) {
+ if (offscreen_context_provider->BindToCurrentThread())
+ offscreen_context_provider->VerifyContexts();
+ offscreen_context_provider = NULL;
+ }
+
+ client_->DidLoseOutputSurfaceOnImplThread();
+
+ if (resource_provider_success) {
+ // If this fails the context provider will be dropped from the output
+ // surface and destroyed. But the GLRenderer expects the output surface
+ // to stick around - and hold onto the context3d - as long as it is alive.
+ // TODO(danakj): Remove the need for this code path: crbug.com/276411
+ renderer_.reset();
+
+ // The resource provider can't stay in GL mode or it tries to clean up GL
+ // stuff, but the context provider is going away on the output surface
+ // which contradicts being in GL mode.
+ // TODO(danakj): Remove the need for this code path: crbug.com/276411
+ resource_provider_->InitializeSoftware();
+ }
}
SetOffscreenContextProvider(offscreen_context_provider);
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698