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