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

Unified Diff: content/common/gpu/texture_image_transport_surface.cc

Issue 10831169: Delay GpuCommandBufferStub::AddDestructionObserver until we need it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 8 years, 4 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 | « content/common/gpu/image_transport_surface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 652e525d824f85fc959d50a2f9222a6fb562e39b..789c38a3908f91859320e3d3dec5e124e93ff50b 100644
--- a/content/common/gpu/texture_image_transport_surface.cc
+++ b/content/common/gpu/texture_image_transport_surface.cc
@@ -47,8 +47,6 @@ TextureImageTransportSurface::TextureImageTransportSurface(
manager,
stub,
gfx::kNullPluginWindow));
-
- stub->AddDestructionObserver(this);
}
TextureImageTransportSurface::~TextureImageTransportSurface() {
@@ -134,9 +132,13 @@ bool TextureImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) {
GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
DLOG(ERROR) << "Framebuffer incomplete.";
+ glDeleteFramebuffersEXT(1, &fbo_id_);
+ fbo_id_ = 0;
return false;
}
#endif
+ DCHECK(helper_->stub());
+ helper_->stub()->AddDestructionObserver(this);
}
return true;
@@ -208,6 +210,7 @@ void TextureImageTransportSurface::OnWillDestroyStub(
ReleaseParentStub();
helper_->SetPreemptByCounter(NULL);
} else {
+ DCHECK(stub == helper_->stub());
stub->RemoveDestructionObserver(this);
// We are losing the stub owning us, this is our last chance to clean up the
« no previous file with comments | « content/common/gpu/image_transport_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698