| Index: content/common/gpu/texture_image_transport_surface.cc
|
| diff --git a/content/common/gpu/texture_image_transport_surface.cc b/content/common/gpu/texture_image_transport_surface.cc
|
| index 67d5637a737e5b9247b4ee74debb409e2e2c5e6c..4f374a159fb4585f52b8aec01375e30c7e9e501e 100644
|
| --- a/content/common/gpu/texture_image_transport_surface.cc
|
| +++ b/content/common/gpu/texture_image_transport_surface.cc
|
| @@ -111,17 +111,8 @@ bool TextureImageTransportSurface::Initialize() {
|
|
|
| void TextureImageTransportSurface::Destroy() {
|
| if (parent_stub_) {
|
| - parent_stub_->RemoveDestructionObserver(this);
|
| - parent_stub_ = NULL;
|
| - }
|
| - for (int i = 0; i < 2; ++i) {
|
| - Texture& texture = textures_[i];
|
| - if (!texture.sent_to_client)
|
| - continue;
|
| - GpuHostMsg_AcceleratedSurfaceRelease_Params params;
|
| - params.identifier = texture.client_id;
|
| - helper_->SendAcceleratedSurfaceRelease(params);
|
| - texture.info = NULL;
|
| + parent_stub_->decoder()->MakeCurrent();
|
| + ReleaseParentStub();
|
| }
|
|
|
| helper_->Destroy();
|
| @@ -197,14 +188,10 @@ void TextureImageTransportSurface::OnResize(gfx::Size size) {
|
|
|
| void TextureImageTransportSurface::OnWillDestroyStub(
|
| GpuCommandBufferStub* stub) {
|
| - stub->RemoveDestructionObserver(this);
|
| if (stub == parent_stub_) {
|
| - // We are losing the parent stub, we need to clear the reference on the
|
| - // infos (they are not allowed to outlive the stub).
|
| - textures_[0].info = NULL;
|
| - textures_[1].info = NULL;
|
| - parent_stub_ = NULL;
|
| + ReleaseParentStub();
|
| } else {
|
| + stub->RemoveDestructionObserver(this);
|
| // We are losing the stub owning us, this is our last chance to clean up the
|
| // resources we allocated in the stub's context.
|
| glDeleteFramebuffersEXT(1, &fbo_id_);
|
| @@ -436,3 +423,18 @@ void TextureImageTransportSurface::AttachBackTextureToFBO() {
|
| }
|
| #endif
|
| }
|
| +
|
| +void TextureImageTransportSurface::ReleaseParentStub() {
|
| + DCHECK(parent_stub_);
|
| + parent_stub_->RemoveDestructionObserver(this);
|
| + for (int i = 0; i < 2; ++i) {
|
| + Texture& texture = textures_[i];
|
| + texture.info = NULL;
|
| + if (!texture.sent_to_client)
|
| + continue;
|
| + GpuHostMsg_AcceleratedSurfaceRelease_Params params;
|
| + params.identifier = texture.client_id;
|
| + helper_->SendAcceleratedSurfaceRelease(params);
|
| + }
|
| + parent_stub_ = NULL;
|
| +}
|
|
|