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