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

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

Issue 77023002: gpu: Add IOSurface backed GpuMemoryBuffer implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review feedback Created 7 years 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_mac.cc
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_mac.cc b/content/common/gpu/client/gpu_memory_buffer_impl_mac.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1c8e5521a01e678e32b4c84d3cb69be2689604bb
--- /dev/null
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_mac.cc
@@ -0,0 +1,38 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/gpu/client/gpu_memory_buffer_impl.h"
+
+#include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h"
+#include "content/common/gpu/client/gpu_memory_buffer_impl_shm.h"
+
+namespace content {
+
+scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create(
+ gfx::GpuMemoryBufferHandle handle,
+ gfx::Size size,
+ unsigned internalformat) {
+ switch (handle.type) {
+ case gfx::SHARED_MEMORY_BUFFER: {
+ scoped_ptr<GpuMemoryBufferImplShm> buffer(
+ new GpuMemoryBufferImplShm(size, internalformat));
+ if (!buffer->Initialize(handle))
+ return scoped_ptr<GpuMemoryBufferImpl>();
+
+ return buffer.PassAs<GpuMemoryBufferImpl>();
+ }
+ case gfx::IO_SURFACE_BUFFER: {
+ scoped_ptr<GpuMemoryBufferImplIOSurface> buffer(
+ new GpuMemoryBufferImplIOSurface(size, internalformat));
+ if (!buffer->Initialize(handle))
+ return scoped_ptr<GpuMemoryBufferImpl>();
+
+ return buffer.PassAs<GpuMemoryBufferImpl>();
+ }
+ default:
+ return scoped_ptr<GpuMemoryBufferImpl>();
+ }
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698