summaryrefslogtreecommitdiffstats
path: root/ui/gl
diff options
context:
space:
mode:
authorkaanb@chromium.org <kaanb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 22:18:57 +0000
committerkaanb@chromium.org <kaanb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 22:18:57 +0000
commitf022d73e4353d3554216e8731bf2eab01778d91a (patch)
tree6be843a6a5d32e674170e5222a4f16f014d9daa5 /ui/gl
parentb5382e56e7748de30b5fbdfb0dab168d725a6cdd (diff)
downloadchromium_src-f022d73e4353d3554216e8731bf2eab01778d91a.zip
chromium_src-f022d73e4353d3554216e8731bf2eab01778d91a.tar.gz
chromium_src-f022d73e4353d3554216e8731bf2eab01778d91a.tar.bz2
Change Map() API to take in a mode for read/write/read-or-write, also pass gfx::Size by value as for small structs it's more efficient.
BUG=175012 Review URL: https://chromiumcodereview.appspot.com/13879002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193234 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gl')
-rw-r--r--ui/gl/gpu_memory_buffer.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/ui/gl/gpu_memory_buffer.h b/ui/gl/gpu_memory_buffer.h
index 2e24903..403c278 100644
--- a/ui/gl/gpu_memory_buffer.h
+++ b/ui/gl/gpu_memory_buffer.h
@@ -18,12 +18,17 @@ class Size;
//
// THREADING CONSIDERATIONS:
//
-// This interface is thread-safe. However, multiple threads calling
-// MapForWrite() simultaneously may result in undefined behavior
-// and is not allowed.
+// 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 GpuMemoryBuffer {
public:
typedef base::Callback<scoped_ptr<gfx::GpuMemoryBuffer>(gfx::Size)> Create;
+ enum AccessMode {
+ READ_ONLY,
+ WRITE_ONLY,
+ READ_OR_WRITE,
+ };
// Frees a previously allocated buffer. Freeing a buffer that is still
// mapped in any process is undefined behavior.
@@ -32,7 +37,7 @@ class GpuMemoryBuffer {
// Maps the buffer so the client can write the bitmap data in |*vaddr|
// subsequently. This call may block, for instance if the hardware needs
// to finish rendering or if CPU caches need to be synchronized.
- virtual void MapForWrite(void** vaddr) = 0;
+ virtual void Map(AccessMode mode, void** vaddr) = 0;
// Unmaps the buffer. Called after all changes to the buffer are
// completed.