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(); |
} |