OLD | NEW |
1 // Copyright (c) 2012 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 CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
6 #define CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
7 | 7 |
8 #if defined(ENABLE_GPU) | 8 #if defined(ENABLE_GPU) |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/cancelable_callback.h" | 14 #include "base/cancelable_callback.h" |
15 #include "base/hash_tables.h" | 15 #include "base/hash_tables.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
18 #include "content/common/gpu/gpu_memory_allocation.h" | 18 #include "content/common/gpu/gpu_memory_allocation.h" |
19 #include "content/public/common/gpu_memory_stats.h" | 19 #include "content/public/common/gpu_memory_stats.h" |
20 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
21 | 21 |
| 22 namespace content { |
22 class GpuCommandBufferStubBase; | 23 class GpuCommandBufferStubBase; |
23 class GpuMemoryTrackingGroup; | 24 } |
24 | 25 |
25 #if defined(COMPILER_GCC) | 26 #if defined(COMPILER_GCC) |
26 namespace BASE_HASH_NAMESPACE { | 27 namespace BASE_HASH_NAMESPACE { |
27 template<> | 28 template<> |
28 struct hash<GpuCommandBufferStubBase*> { | 29 struct hash<content::GpuCommandBufferStubBase*> { |
29 size_t operator()(GpuCommandBufferStubBase* ptr) const { | 30 size_t operator()(content::GpuCommandBufferStubBase* ptr) const { |
30 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | 31 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
31 } | 32 } |
32 }; | 33 }; |
33 } // namespace BASE_HASH_NAMESPACE | 34 } // namespace BASE_HASH_NAMESPACE |
34 #endif // COMPILER | 35 #endif // COMPILER |
35 | 36 |
| 37 namespace content { |
| 38 class GpuMemoryTrackingGroup; |
| 39 |
36 class CONTENT_EXPORT GpuMemoryManagerClient { | 40 class CONTENT_EXPORT GpuMemoryManagerClient { |
37 public: | 41 public: |
38 virtual ~GpuMemoryManagerClient() {} | 42 virtual ~GpuMemoryManagerClient() {} |
39 | 43 |
40 virtual void AppendAllCommandBufferStubs( | 44 virtual void AppendAllCommandBufferStubs( |
41 std::vector<GpuCommandBufferStubBase*>& stubs) = 0; | 45 std::vector<GpuCommandBufferStubBase*>& stubs) = 0; |
42 }; | 46 }; |
43 | 47 |
44 class CONTENT_EXPORT GpuMemoryManager : | 48 class CONTENT_EXPORT GpuMemoryManager : |
45 public base::SupportsWeakPtr<GpuMemoryManager> { | 49 public base::SupportsWeakPtr<GpuMemoryManager> { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 173 |
170 // The number of browser windows that exist. If we ever receive a | 174 // The number of browser windows that exist. If we ever receive a |
171 // GpuMsg_SetVideoMemoryWindowCount, then we use this to compute memory | 175 // GpuMsg_SetVideoMemoryWindowCount, then we use this to compute memory |
172 // budgets, instead of doing more complicated stub-based calculations. | 176 // budgets, instead of doing more complicated stub-based calculations. |
173 bool window_count_has_been_received_; | 177 bool window_count_has_been_received_; |
174 uint32 window_count_; | 178 uint32 window_count_; |
175 | 179 |
176 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); | 180 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); |
177 }; | 181 }; |
178 | 182 |
| 183 } // namespace content |
| 184 |
179 #endif | 185 #endif |
180 | 186 |
181 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 187 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
OLD | NEW |