Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
index ae331e5a4a080d4cf275e8cb35d2caf30011a28a..d23dbd9f5ea9c53204e7b941d6fc7b3558720feb 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -563,6 +563,7 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { |
bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override; |
void UpdateParentTextureInfo(); |
bool MakeCurrent() override; |
+ void ReleaseCurrent() override; |
GLES2Util* GetGLES2Util() override { return &util_; } |
gfx::GLContext* GetGLContext() override { return context_.get(); } |
ContextGroup* GetContextGroup() override { return group_.get(); } |
@@ -3612,6 +3613,18 @@ bool GLES2DecoderImpl::MakeCurrent() { |
return true; |
} |
+void GLES2DecoderImpl::ReleaseCurrent() { |
+ if (!context_.get()) |
+ return; |
+ |
+ if (WasContextLost()) { |
+ LOG(ERROR) << " GLES2DecoderImpl: Trying to release lost context."; |
+ return; |
+ } |
+ |
+ context_->ReleaseCurrent(surface_.get()); |
+} |
+ |
void GLES2DecoderImpl::ProcessFinishedAsyncTransfers() { |
ProcessPendingReadPixels(false); |
if (engine() && query_manager_.get()) |
@@ -4133,7 +4146,7 @@ void GLES2DecoderImpl::Destroy(bool have_context) { |
void GLES2DecoderImpl::SetSurface( |
const scoped_refptr<gfx::GLSurface>& surface) { |
DCHECK(context_->IsCurrent(NULL)); |
- DCHECK(surface_.get()); |
+ // Surface can be null, but then the client should not use the decoder. |
surface_ = surface; |
RestoreCurrentFramebufferBindings(); |
} |