Index: cc/resources/graphic_buffer.h |
diff --git a/cc/resources/graphic_buffer.h b/cc/resources/graphic_buffer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..04f69c888042c76bacacffd74ccc5e96fac0e655 |
--- /dev/null |
+++ b/cc/resources/graphic_buffer.h |
@@ -0,0 +1,45 @@ |
+// 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. |
+ |
+#ifndef CC_RESOURCES_GRAPHIC_BUFFER_H_ |
+#define CC_RESOURCES_GRAPHIC_BUFFER_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/callback.h" |
+#include "base/memory/scoped_ptr.h" |
+ |
+namespace gfx { |
+class Size; |
+} |
+ |
+namespace cc { |
+ |
+// Interface for creating and accessing a zero-copy buffer such as GraphicBuffer |
+// of Android framework. |
+class GraphicBuffer { |
joth
2013/04/02 19:12:11
can we make and statements about the thread safety
kaanb
2013/04/02 23:16:54
Done.
|
+ public: |
+ // This factory is called in ResourceProvider::CreateGraphicBuffer() to |
joth
2013/04/02 19:12:11
this comment is incorrect w.r.t this patch in isol
kaanb
2013/04/02 23:16:54
Done.
|
+ // create new instances. |
+ typedef base::Callback<scoped_ptr<cc::GraphicBuffer>(const gfx::Size&)> |
+ Factory; |
+ virtual ~GraphicBuffer() {} |
+ |
+ // Locks the buffer for the usage specified so the client |
+ // can read or write the bitmap data in |*vaddr| subsequently. |
+ // Returns 0 on success, non-zero on failure. |
+ virtual bool LockForRead(void** vaddr) = 0; |
+ virtual bool LockForWrite(void** vaddr) = 0; |
+ // Unlocks the buffer. Returns 0 on success, non-zero otherwise. |
joth
2013/04/02 19:12:11
Also document:-
1/ can LockForRead be followed by
kaanb
2013/04/02 23:16:54
Actually the Lock() is somewhat of a misnomer. Loo
|
+ virtual bool Unlock() = 0; |
+ // Returns the size of the buffer |
+ virtual gfx::Size GetSize() = 0; |
+ // Returns the native pointer for the graphic buffer. |
+ virtual void* GetNativeBuffer() = 0; |
+ // Returns the stride for the graphic buffer. |
+ virtual uint32 GetStride() = 0; |
+}; |
+ |
+} // namespace cc |
+ |
+#endif // CC_RESOURCES_GRAPHIC_BUFFER_H_ |