Chromium Code Reviews| 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 52118fb73103847f9c600b57d56b38f3c1894a02..f3c3d22864d125fa3c5dac88848fe1aa2d600174 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -577,6 +577,7 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { |
| const std::vector<int32_t>& attribs) override; |
| void Destroy(bool have_context) override; |
| void SetSurface(const scoped_refptr<gfx::GLSurface>& surface) override; |
| + void ReleaseSurface() override; |
| void ProduceFrontBuffer(const Mailbox& mailbox) override; |
| bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override; |
| void UpdateParentTextureInfo(); |
| @@ -4156,11 +4157,22 @@ void GLES2DecoderImpl::Destroy(bool have_context) { |
| void GLES2DecoderImpl::SetSurface( |
| const scoped_refptr<gfx::GLSurface>& surface) { |
| DCHECK(context_->IsCurrent(NULL)); |
| - DCHECK(surface_.get()); |
| + DCHECK(surface); |
| surface_ = surface; |
| RestoreCurrentFramebufferBindings(); |
| } |
| +void GLES2DecoderImpl::ReleaseSurface() { |
| + if (!context_.get()) |
| + return; |
| + if (WasContextLost()) { |
| + LOG(ERROR) << " GLES2DecoderImpl: Trying to release lost context."; |
|
piman
2016/02/23 23:37:16
nit: DLOG
Kimmo Kinnunen
2016/02/24 07:33:26
Done.
|
| + return; |
| + } |
| + context_->ReleaseCurrent(surface_.get()); |
| + surface_ = nullptr; |
| +} |
| + |
| void GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) { |
| if (!offscreen_saved_color_texture_.get()) { |
| LOG(ERROR) << "Called ProduceFrontBuffer on a non-offscreen context"; |