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

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

Issue 600693002: content: Cleanup GpuMemoryBufferImpl destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove scoped_refptr<> from sender param of DeletedGpuMemoryBuffer 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_io_surface.cc
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc b/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc
index 029ea4f7c5b0c79172bc76d4c092e760a3fb278a..f67c8a194950559dd6d9ee10d5b9800287c91812 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc
@@ -4,17 +4,38 @@
#include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h"
-#include "base/logging.h"
#include "ui/gl/gl_bindings.h"
namespace content {
GpuMemoryBufferImplIOSurface::GpuMemoryBufferImplIOSurface(
const gfx::Size& size,
- unsigned internalformat)
- : GpuMemoryBufferImpl(size, internalformat) {}
+ unsigned internalformat,
+ const DestructionCallback& callback,
+ IOSurfaceRef io_surface)
+ : GpuMemoryBufferImpl(size, internalformat, callback),
+ io_surface_(io_surface) {
+}
+
+GpuMemoryBufferImplIOSurface::~GpuMemoryBufferImplIOSurface() {
+}
+
+// static
+scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImplIOSurface::CreateFromHandle(
+ const gfx::GpuMemoryBufferHandle& handle,
+ const gfx::Size& size,
+ unsigned internalformat,
+ const DestructionCallback& callback) {
+ DCHECK(IsFormatSupported(internalformat));
+
+ base::ScopedCFTypeRef<IOSurfaceRef> io_surface(
+ IOSurfaceLookup(handle.io_surface_id));
+ if (!io_surface)
+ return scoped_ptr<GpuMemoryBufferImpl>();
-GpuMemoryBufferImplIOSurface::~GpuMemoryBufferImplIOSurface() {}
+ return make_scoped_ptr<GpuMemoryBufferImpl>(new GpuMemoryBufferImplIOSurface(
+ size, internalformat, callback, io_surface.get()));
+}
// static
bool GpuMemoryBufferImplIOSurface::IsFormatSupported(unsigned internalformat) {
@@ -54,18 +75,6 @@ uint32 GpuMemoryBufferImplIOSurface::PixelFormat(unsigned internalformat) {
}
}
-bool GpuMemoryBufferImplIOSurface::InitializeFromHandle(
- const gfx::GpuMemoryBufferHandle& handle) {
- DCHECK(IsFormatSupported(internalformat_));
- io_surface_.reset(IOSurfaceLookup(handle.io_surface_id));
- if (!io_surface_) {
- VLOG(1) << "IOSurface lookup failed";
- return false;
- }
-
- return true;
-}
-
void* GpuMemoryBufferImplIOSurface::Map() {
DCHECK(!mapped_);
IOSurfaceLock(io_surface_, 0, NULL);

Powered by Google App Engine
This is Rietveld 408576698