Index: ui/gfx/gpu_memory_buffer.h |
diff --git a/gpu/command_buffer/client/gpu_memory_buffer.h b/ui/gfx/gpu_memory_buffer.h |
similarity index 54% |
rename from gpu/command_buffer/client/gpu_memory_buffer.h |
rename to ui/gfx/gpu_memory_buffer.h |
index d1de7a445276778edfa9c2d7f593ffa7e8670ea3..a03d08d5e11fd3b10d83d1985b529226770db91a 100644 |
--- a/gpu/command_buffer/client/gpu_memory_buffer.h |
+++ b/ui/gfx/gpu_memory_buffer.h |
@@ -2,14 +2,40 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_ |
-#define GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_ |
+#ifndef GPU_UI_GFX_GPU_MEMORY_BUFFER_H_ |
+#define GPU_UI_GFX_GPU_MEMORY_BUFFER_H_ |
-#include "base/basictypes.h" |
-#include "base/memory/scoped_ptr.h" |
-#include "gles2_impl_export.h" |
+#include "base/logging.h" |
+#include "base/memory/shared_memory.h" |
+#include "ui/base/ui_export.h" |
-namespace gpu { |
+#if defined(OS_ANDROID) |
+#include <third_party/khronos/EGL/egl.h> |
kaanb
2013/07/24 03:31:23
I had added a define for EGL_NATIVE_BUFFER_ANDROID
reveman
2013/07/24 05:47:12
Oh, would it be more appropriate to include gl_bin
reveman
2013/07/25 19:50:25
Removed your EGL_NATIVE_BUFFER_ANDROID define from
|
+#endif |
+ |
+namespace gfx { |
+ |
+enum GpuMemoryBufferType { |
+ EMPTY_BUFFER, |
+ SHARED_MEMORY_BUFFER, |
+ EGL_CLIENT_BUFFER |
+}; |
+ |
+struct GpuMemoryBufferHandle { |
+ GpuMemoryBufferHandle() : type(EMPTY_BUFFER) {} |
+ GpuMemoryBufferHandle( |
+ base::SharedMemoryHandle handle_, GpuMemoryBufferType type_) |
+ : type(type_), |
+ handle(handle_) { |
+ DCHECK(!is_null()); |
+ } |
+ bool is_null() const { return type == EMPTY_BUFFER; } |
+ GpuMemoryBufferType type; |
+ base::SharedMemoryHandle handle; |
+#if defined(OS_ANDROID) |
+ EGLClientBuffer native_buffer; |
+#endif |
+}; |
// Interface for creating and accessing a zero-copy GPU memory buffer. |
// This design evolved from the generalization of GraphicBuffer API |
@@ -20,7 +46,7 @@ namespace gpu { |
// This interface is thread-safe. However, multiple threads mapping |
// a buffer for Write or ReadOrWrite simultaneously may result in undefined |
// behavior and is not allowed. |
-class GLES2_IMPL_EXPORT GpuMemoryBuffer { |
+class UI_EXPORT GpuMemoryBuffer { |
public: |
enum AccessMode { |
READ_ONLY, |
@@ -42,15 +68,15 @@ class GLES2_IMPL_EXPORT GpuMemoryBuffer { |
virtual void Unmap() = 0; |
// Returns true iff the buffer is mapped. |
- virtual bool IsMapped() = 0; |
- |
- // Returns the native pointer for the buffer. |
- virtual void* GetNativeBuffer() = 0; |
+ virtual bool IsMapped() const = 0; |
// Returns the stride in bytes for the buffer. |
- virtual uint32 GetStride() = 0; |
+ virtual uint32 GetStride() const = 0; |
+ |
+ // Returns a platform specific handle for this buffer. |
+ virtual GpuMemoryBufferHandle GetHandle() const = 0; |
}; |
-} // namespace gpu |
+} // namespace gfx |
-#endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_ |
+#endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |