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

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

Issue 10200012: texture_image_transport: have a current context when we're releasing textures (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/texture_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 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;
+}
« no previous file with comments | « content/common/gpu/texture_image_transport_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698