Chromium Code Reviews| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
| 10 | 10 |
| 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/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/public/common/gpu_mem_stats.h" | |
| 17 | 18 |
| 18 class GpuCommandBufferStubBase; | 19 class GpuCommandBufferStubBase; |
| 19 | 20 |
| 20 class CONTENT_EXPORT GpuMemoryManagerClient { | 21 class CONTENT_EXPORT GpuMemoryManagerClient { |
| 21 public: | 22 public: |
| 22 virtual ~GpuMemoryManagerClient() {} | 23 virtual ~GpuMemoryManagerClient() {} |
| 23 | 24 |
| 24 virtual void AppendAllCommandBufferStubs( | 25 virtual void AppendAllCommandBufferStubs( |
| 25 std::vector<GpuCommandBufferStubBase*>& stubs) = 0; | 26 std::vector<GpuCommandBufferStubBase*>& stubs) = 0; |
| 26 }; | 27 }; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 51 size_t max_surfaces_with_frontbuffer_soft_limit); | 52 size_t max_surfaces_with_frontbuffer_soft_limit); |
| 52 ~GpuMemoryManager(); | 53 ~GpuMemoryManager(); |
| 53 | 54 |
| 54 // Schedule a Manage() call. If immediate is true, we PostTask without delay. | 55 // Schedule a Manage() call. If immediate is true, we PostTask without delay. |
| 55 // Otherwise PostDelayedTask using a CancelableClosure and allow multiple | 56 // Otherwise PostDelayedTask using a CancelableClosure and allow multiple |
| 56 // delayed calls to "queue" up. This way, we do not spam clients in certain | 57 // delayed calls to "queue" up. This way, we do not spam clients in certain |
| 57 // lower priority situations. An immediate schedule manage will cancel any | 58 // lower priority situations. An immediate schedule manage will cancel any |
| 58 // queued delayed manage. | 59 // queued delayed manage. |
| 59 void ScheduleManage(bool immediate); | 60 void ScheduleManage(bool immediate); |
| 60 | 61 |
| 62 // Populate stats with statistics on memory usage | |
| 63 void GetMemStats(content::GpuMemStats& stats); | |
|
mmocny
2012/07/17 19:26:04
In the CL I posted, I proposed GpuMemoryManager pr
ccameron
2012/07/17 20:00:47
Yeah, I thought this would be the case -- I'll upd
| |
| 64 | |
| 61 private: | 65 private: |
| 62 friend class GpuMemoryManagerTest; | 66 friend class GpuMemoryManagerTest; |
| 63 void Manage(); | 67 void Manage(); |
| 64 | 68 |
| 65 class CONTENT_EXPORT StubWithSurfaceComparator { | 69 class CONTENT_EXPORT StubWithSurfaceComparator { |
| 66 public: | 70 public: |
| 67 bool operator()(GpuCommandBufferStubBase* lhs, | 71 bool operator()(GpuCommandBufferStubBase* lhs, |
| 68 GpuCommandBufferStubBase* rhs); | 72 GpuCommandBufferStubBase* rhs); |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 GpuMemoryManagerClient* client_; | 75 GpuMemoryManagerClient* client_; |
| 72 | 76 |
| 73 base::CancelableClosure delayed_manage_callback_; | 77 base::CancelableClosure delayed_manage_callback_; |
| 74 bool manage_immediate_scheduled_; | 78 bool manage_immediate_scheduled_; |
| 75 | 79 |
| 76 size_t max_surfaces_with_frontbuffer_soft_limit_; | 80 size_t max_surfaces_with_frontbuffer_soft_limit_; |
| 77 | 81 |
| 78 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); | 82 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); |
| 79 }; | 83 }; |
| 80 | 84 |
| 81 #endif | 85 #endif |
| 82 | 86 |
| 83 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 87 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
| OLD | NEW |