OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 COMPONENTS_EXO_SHARED_MEMORY_H_ |
| 6 #define COMPONENTS_EXO_SHARED_MEMORY_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/shared_memory.h" |
| 11 #include "ui/gfx/buffer_types.h" |
| 12 #include "ui/gfx/geometry/size.h" |
| 13 |
| 14 namespace exo { |
| 15 class Buffer; |
| 16 |
| 17 // Shared memory abstraction. Provides a wrapper around base::SharedMemory |
| 18 // with functionality to create buffers from the memory to use for display. |
| 19 class SharedMemory { |
| 20 public: |
| 21 explicit SharedMemory(const base::SharedMemoryHandle& handle); |
| 22 ~SharedMemory(); |
| 23 |
| 24 // Creates a buffer from the shared memory. The buffer is created offset bytes |
| 25 // into the memory and has width and height as specified. The stride |
| 26 // arguments specifies the number of bytes from beginning of one row to the |
| 27 // beginning of the next. The format is the pixel format of the buffer and |
| 28 // must be one of RGBX_8888, RGBA_8888, BGRX_8888, BGRA_8888. |
| 29 scoped_ptr<Buffer> CreateBuffer(const gfx::Size& size, |
| 30 gfx::BufferFormat format, |
| 31 unsigned offset, |
| 32 int stride); |
| 33 |
| 34 private: |
| 35 base::SharedMemory shared_memory_; |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(SharedMemory); |
| 38 }; |
| 39 |
| 40 } // namespace exo |
| 41 |
| 42 #endif // COMPONENTS_EXO_SHARED_MEMORY_H_ |
OLD | NEW |