diff options
author | sohan.jyoti@samsung.com <sohan.jyoti@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-31 15:01:24 +0000 |
---|---|---|
committer | sohan.jyoti@samsung.com <sohan.jyoti@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-31 15:01:24 +0000 |
commit | d2eaf52f4ae894c8da8b6856c20780fcaa53bd3c (patch) | |
tree | 2870a82512913e9c19115d0120b9f5e18bbb7de0 /content/common/gpu/gpu_command_buffer_stub.cc | |
parent | ff7fcb7bca105d8708d9499bb77822a1cac86edd (diff) | |
download | chromium_src-d2eaf52f4ae894c8da8b6856c20780fcaa53bd3c.zip chromium_src-d2eaf52f4ae894c8da8b6856c20780fcaa53bd3c.tar.gz chromium_src-d2eaf52f4ae894c8da8b6856c20780fcaa53bd3c.tar.bz2 |
During image destroy, delete textures only if we have a GL context.
This adds Destroy function for ImageManager and invoke it from
command decoder destroy path with GL context info.
This is to ensure that when we destroy the image,
textures to which the image is bound to,
is deleted only if we have a GL context.
BUG=375507
Review URL: https://codereview.chromium.org/301793003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286811 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/gpu/gpu_command_buffer_stub.cc')
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.cc | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index c156d3f..989e00b 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( |