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

Unified Diff: cc/resources/graphic_buffer.h

Issue 13135004: android_webview: changes to support Android GraphicBuffers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add GetStride() API on the GraphicBuffer Created 7 years, 9 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
« android_webview/renderer/aw_content_renderer_client.cc ('K') | « cc/cc.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« android_webview/renderer/aw_content_renderer_client.cc ('K') | « cc/cc.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698