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

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: 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
« no previous file with comments | « cc/resources/scoped_gpu_raster.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..013aef4865a8e68e70c97f9dd377f9e47ec6224e 100644
--- a/content/common/gpu/client/context_provider_command_buffer.cc
+++ b/content/common/gpu/client/context_provider_command_buffer.cc
@@ -134,11 +134,14 @@ class GrContext* ContextProviderCommandBuffer::GrContext() {
if (gr_context_)
return gr_context_->get();
+ // If 3d context is lost, skip trying to make a GrContext which could fail.
+ if (IsContextLost())
+ return nullptr;
+
gr_context_.reset(new GrContextForWebGraphicsContext3D(context3d_.get()));
- // If GlContext is already lost, also abandon the new GrContext.
- if (IsContextLost())
- gr_context_->get()->abandonContext();
+ // GrContext creation should not fail with a valid context.
piman 2015/05/12 22:06:11 I'm not sure that's true. IsContextLost() is funda
+ DCHECK(gr_context_->get());
return gr_context_->get();
}
« no previous file with comments | « cc/resources/scoped_gpu_raster.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698