OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ |
6 #define GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
| 10 #include "../../gpu_export.h" |
10 #include "../common/types.h" | 11 #include "../common/types.h" |
11 #include "../client/fenced_allocator.h" | 12 #include "../client/fenced_allocator.h" |
12 #include "../common/buffer.h" | 13 #include "../common/buffer.h" |
13 | 14 |
14 namespace gpu { | 15 namespace gpu { |
15 | 16 |
16 class CommandBufferHelper; | 17 class CommandBufferHelper; |
17 | 18 |
18 // Manages a shared memory segment. | 19 // Manages a shared memory segment. |
19 class MemoryChunk { | 20 class GPU_EXPORT MemoryChunk { |
20 public: | 21 public: |
21 MemoryChunk(int32 shm_id, gpu::Buffer shm, CommandBufferHelper* helper); | 22 MemoryChunk(int32 shm_id, gpu::Buffer shm, CommandBufferHelper* helper); |
22 | 23 |
23 // Gets the size of the largest free block that is available without waiting. | 24 // Gets the size of the largest free block that is available without waiting. |
24 unsigned int GetLargestFreeSizeWithoutWaiting() { | 25 unsigned int GetLargestFreeSizeWithoutWaiting() { |
25 return allocator_.GetLargestFreeSize(); | 26 return allocator_.GetLargestFreeSize(); |
26 } | 27 } |
27 | 28 |
28 // Gets the size of the largest free block that can be allocated if the | 29 // Gets the size of the largest free block that can be allocated if the |
29 // caller can wait. | 30 // caller can wait. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 98 |
98 private: | 99 private: |
99 int32 shm_id_; | 100 int32 shm_id_; |
100 gpu::Buffer shm_; | 101 gpu::Buffer shm_; |
101 FencedAllocatorWrapper allocator_; | 102 FencedAllocatorWrapper allocator_; |
102 | 103 |
103 DISALLOW_COPY_AND_ASSIGN(MemoryChunk); | 104 DISALLOW_COPY_AND_ASSIGN(MemoryChunk); |
104 }; | 105 }; |
105 | 106 |
106 // Manages MemoryChucks. | 107 // Manages MemoryChucks. |
107 class MappedMemoryManager { | 108 class GPU_EXPORT MappedMemoryManager { |
108 public: | 109 public: |
109 explicit MappedMemoryManager(CommandBufferHelper* helper); | 110 explicit MappedMemoryManager(CommandBufferHelper* helper); |
110 | 111 |
111 ~MappedMemoryManager(); | 112 ~MappedMemoryManager(); |
112 | 113 |
113 unsigned int chunk_size_multiple() const { | 114 unsigned int chunk_size_multiple() const { |
114 return chunk_size_multiple_; | 115 return chunk_size_multiple_; |
115 } | 116 } |
116 | 117 |
117 void set_chunk_size_multiple(unsigned int multiple) { | 118 void set_chunk_size_multiple(unsigned int multiple) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 CommandBufferHelper* helper_; | 159 CommandBufferHelper* helper_; |
159 MemoryChunkVector chunks_; | 160 MemoryChunkVector chunks_; |
160 | 161 |
161 DISALLOW_COPY_AND_ASSIGN(MappedMemoryManager); | 162 DISALLOW_COPY_AND_ASSIGN(MappedMemoryManager); |
162 }; | 163 }; |
163 | 164 |
164 } // namespace gpu | 165 } // namespace gpu |
165 | 166 |
166 #endif // GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ | 167 #endif // GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ |
167 | 168 |
OLD | NEW |