| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_COMMON_GPU_MEDIA_SHARED_MEMORY_REGION_H_ | 5 #ifndef MEDIA_GPU_SHARED_MEMORY_REGION_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_SHARED_MEMORY_REGION_H_ | 6 #define MEDIA_GPU_SHARED_MEMORY_REGION_H_ |
| 7 | 7 |
| 8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "media/base/bitstream_buffer.h" | 9 #include "media/base/bitstream_buffer.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace media { |
| 12 | 12 |
| 13 // Helper class to access a region of a SharedMemory. Different from | 13 // Helper class to access a region of a SharedMemory. Different from |
| 14 // SharedMemory, in which the |offset| of function MapAt() must be aligned to | 14 // SharedMemory, in which the |offset| of function MapAt() must be aligned to |
| 15 // the value of |SysInfo::VMAllocationGranularity()|, the |offset| of a | 15 // the value of |SysInfo::VMAllocationGranularity()|, the |offset| of a |
| 16 // SharedMemoryRegion needs not to be aligned, this class hides the details | 16 // SharedMemoryRegion needs not to be aligned, this class hides the details |
| 17 // and returns the mapped address of the given offset. | 17 // and returns the mapped address of the given offset. |
| 18 class SharedMemoryRegion { | 18 class SharedMemoryRegion { |
| 19 public: | 19 public: |
| 20 // Creates a SharedMemoryRegion. | 20 // Creates a SharedMemoryRegion. |
| 21 // The mapped memory region begins at |offset| bytes from the start of the | 21 // The mapped memory region begins at |offset| bytes from the start of the |
| (...skipping 23 matching lines...) Expand all Loading... |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 base::SharedMemory shm_; | 47 base::SharedMemory shm_; |
| 48 off_t offset_; | 48 off_t offset_; |
| 49 size_t size_; | 49 size_t size_; |
| 50 size_t alignment_size_; | 50 size_t alignment_size_; |
| 51 | 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(SharedMemoryRegion); | 52 DISALLOW_COPY_AND_ASSIGN(SharedMemoryRegion); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } // namespace content | 55 } // namespace media |
| 56 | 56 |
| 57 #endif // CONTENT_COMMON_GPU_MEDIA_SHARED_MEMORY_REGION_H_ | 57 #endif // MEDIA_GPU_SHARED_MEMORY_REGION_H_ |
| OLD | NEW |