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 189215122af0bff2aeb71e88d7364c1a7ad0fe21..77ec5feadef637fb7d8b3c8c37cee2de2fd14d00 100644 |
--- a/content/common/gpu/gpu_command_buffer_stub.cc |
+++ b/content/common/gpu/gpu_command_buffer_stub.cc |
@@ -946,6 +946,10 @@ void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer( |
if (decoder_) { |
gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
DCHECK(image_manager); |
+ if (id <= 0) { |
reveman
2014/07/25 19:00:23
I don't think this check should exist. Either we c
sohanjg
2014/07/26 10:42:22
Done.
|
+ LOG(ERROR) << "Cannot add image with non-positive ID."; |
+ return; |
+ } |
image_manager->AddImage(image.get(), id); |
reveman
2014/07/25 19:00:23
You need to check for collisions before this call.
sohanjg
2014/07/26 10:42:23
Done.
|
} |
} |
@@ -956,6 +960,11 @@ void GpuCommandBufferStub::OnDestroyGpuMemoryBuffer(int32 id) { |
if (decoder_) { |
gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
DCHECK(image_manager); |
+ if (id <= 0) { |
reveman
2014/07/25 19:00:23
this check shouldn't exist.
sohanjg
2014/07/26 10:42:22
Done.
|
+ LOG(ERROR) << "Cannot remove image with non-positive ID."; |
+ return; |
+ } |
+ DCHECK(image_manager->LookupImage(id)); |
reveman
2014/07/25 19:00:23
A DCHECK is not OK here. We need to log an error a
sohanjg
2014/07/26 10:42:23
Done.
|
image_manager->RemoveImage(id); |
} |
} |