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

Unified Diff: content/common/gpu/client/context_provider_command_buffer.cc

Issue 1135743004: cc: Add null checks for GrContext created by ContextProviderCommandBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Create and check GrContext early in LTHI::InitializeRenderer() Created 5 years, 7 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
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/client/context_provider_command_buffer.cc
diff --git a/content/common/gpu/client/context_provider_command_buffer.cc b/content/common/gpu/client/context_provider_command_buffer.cc
index eb7096499b2d23d29552e8c61b652968f97e7267..56c06dbf7c3b27d530894349487cd1c079dc7086 100644
--- a/content/common/gpu/client/context_provider_command_buffer.cc
+++ b/content/common/gpu/client/context_provider_command_buffer.cc
@@ -134,11 +134,17 @@ class GrContext* ContextProviderCommandBuffer::GrContext() {
if (gr_context_)
return gr_context_->get();
+ // If GlContext is already lost, skip trying to make a GrContext which
+ // could fail.
+ if (IsContextLost())
+ return nullptr;
piman 2015/05/12 23:33:51 I'd skip this part. No use trying to optimize for
+
gr_context_.reset(new GrContextForWebGraphicsContext3D(context3d_.get()));
- // If GlContext is already lost, also abandon the new GrContext.
- if (IsContextLost())
- gr_context_->get()->abandonContext();
+ // If GlContext was lost after the GrContext initialization, delete
+ // the GrContext.
+ if (gr_context_->get() && IsContextLost())
+ gr_context_.reset(nullptr);
return gr_context_->get();
}
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698