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

Unified Diff: content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc

Issue 600693002: content: Cleanup GpuMemoryBufferImpl destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
Index: content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc
index 4c1534db191be9824d9603454e1fd2e762f06936..7f9b18d69657546830dee2137649ed9df43f4d3c 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc
@@ -4,18 +4,31 @@
#include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
+#include "base/bind.h"
#include "base/numerics/safe_math.h"
#include "ui/gl/gl_bindings.h"
namespace content {
+namespace {
+
+void Noop() {
+}
+
+} // namespace
GpuMemoryBufferImplSharedMemory::GpuMemoryBufferImplSharedMemory(
const gfx::Size& size,
- unsigned internalformat)
- : GpuMemoryBufferImpl(size, internalformat) {
+ unsigned internalformat,
+ const DestructionCallback& callback)
+ : GpuMemoryBufferImpl(size, internalformat), callback_(callback) {
}
GpuMemoryBufferImplSharedMemory::~GpuMemoryBufferImplSharedMemory() {
+ if (!shared_memory_)
+ return;
+
+ // Call destruction callback if instance was successfully initialized.
+ callback_.Run();
}
// static
@@ -27,7 +40,8 @@ void GpuMemoryBufferImplSharedMemory::Create(const gfx::Size& size,
size, internalformat, usage));
scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer(
- new GpuMemoryBufferImplSharedMemory(size, internalformat));
+ new GpuMemoryBufferImplSharedMemory(
+ size, internalformat, base::Bind(&Noop)));
if (buffer->Initialize()) {
callback.Run(buffer.PassAs<GpuMemoryBufferImpl>());
return;

Powered by Google App Engine
This is Rietveld 408576698