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

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

Issue 301793003: During image destroy, delete textures only if we have a GL context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolve android clang dbg build issue. Created 6 years, 5 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 | « no previous file | content/common/gpu/stream_texture_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_command_buffer_stub.cc
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index c156d3fe2b0210ab7880ca4474074d51e31dedb2..989e00bc5cfc0bf7e716f601b16edde781609d53 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -966,6 +966,16 @@ void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer(
}
#endif
+ if (!decoder_)
+ return;
+
+ gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
+ DCHECK(image_manager);
+ if (image_manager->LookupImage(id)) {
+ LOG(ERROR) << "Image already exists with same ID.";
+ return;
+ }
+
GpuChannelManager* manager = channel_->gpu_channel_manager();
scoped_refptr<gfx::GLImage> image =
manager->gpu_memory_buffer_factory()->CreateImageForGpuMemoryBuffer(
@@ -980,21 +990,23 @@ void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer(
if (context_group_->feature_info()->workarounds().release_image_after_use)
image->SetReleaseAfterUse();
- if (decoder_) {
- gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
- DCHECK(image_manager);
- image_manager->AddImage(image.get(), id);
- }
+ image_manager->AddImage(image.get(), id);
}
void GpuCommandBufferStub::OnUnregisterGpuMemoryBuffer(int32 id) {
TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnUnregisterGpuMemoryBuffer");
- if (decoder_) {
- gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
- DCHECK(image_manager);
- image_manager->RemoveImage(id);
+ if (!decoder_)
+ return;
+
+ gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
+ DCHECK(image_manager);
+ if (!image_manager->LookupImage(id)) {
+ LOG(ERROR) << "Image with ID doesn't exist.";
+ return;
}
+
+ image_manager->RemoveImage(id);
}
void GpuCommandBufferStub::SendConsoleMessage(
« no previous file with comments | « no previous file | content/common/gpu/stream_texture_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698