Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_GL_PIXEL_BUFFER_H_ | |
| 6 #define UI_GL_PIXEL_BUFFER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/callback.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 | |
| 12 namespace gfx { | |
| 13 class Size; | |
| 14 | |
| 15 // Interface for creating and accessing a zero-copy buffer such as GraphicBuffer | |
| 16 // of Android framework. | |
|
joth
2013/04/04 21:53:34
comment should be generalized.
(could note the de
kaanb
2013/04/04 22:26:18
Done.
| |
| 17 // | |
| 18 // THREADING CONSIDERATIONS: | |
|
joth
2013/04/04 21:53:34
also mention about the other non-mapping methods -
kaanb
2013/04/04 22:26:18
Done.
| |
| 19 // | |
| 20 // It is legal for several different threads to lock a buffer from | |
| 21 // read access, none of the threads are blocked. | |
|
joth
2013/04/04 21:53:34
remove - there is no read access now.
kaanb
2013/04/04 22:26:18
Done.
| |
| 22 // However, locking a buffer simultaneously for write or read/write is | |
| 23 // undefined, but: | |
| 24 // - shall not result in termination of the process | |
| 25 // - shall not block the caller | |
|
joth
2013/04/04 21:53:34
This comment is too directed to the implementer, a
kaanb
2013/04/04 22:26:18
I've somewhat modified your suggestion, PTAL.
| |
| 26 // It is acceptable to return an error or to leave the buffer's content | |
| 27 // into an indeterminate state. | |
|
joth
2013/04/04 21:53:34
? this is a comment to the implementer, not the us
kaanb
2013/04/04 22:26:18
Removed
| |
| 28 class PixelBuffer { | |
| 29 public: | |
| 30 // The factory is set by the ContentRendererClient::GetPixelBufferFactory() | |
| 31 // method. | |
| 32 typedef base::Callback<scoped_ptr<gfx::PixelBuffer>(gfx::Size)> Create; | |
| 33 | |
| 34 virtual ~PixelBuffer() {} | |
| 35 | |
| 36 // Maps the buffer so the client can write the bitmap data in |*vaddr| | |
| 37 // subsequently. This call may block, for instance if the h/w needs | |
| 38 // to finish rendering or if CPU caches need to be synchronized. | |
| 39 virtual void MapForWrite(void** vaddr) = 0; | |
| 40 | |
| 41 // Unmaps the buffer. Called after all changes to the buffer are | |
| 42 // completed. | |
| 43 virtual void Unmap() = 0; | |
| 44 | |
| 45 // Returns the native pointer for the graphic buffer. | |
| 46 virtual void* GetNativeBuffer() = 0; | |
| 47 | |
| 48 // Returns the stride for the graphic buffer. | |
|
joth
2013/04/04 21:53:34
in pixels or bytes?
kaanb
2013/04/04 22:26:18
pixels. Clarified the comment.
| |
| 49 virtual uint32 GetStride() = 0; | |
| 50 }; | |
| 51 | |
| 52 } // namespace gfx | |
| 53 | |
| 54 #endif // UI_GL_PIXEL_BUFFER_H_ | |
| OLD | NEW |