Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1269)

Unified Diff: content/common/gpu/gpu_memory_manager.h

Issue 10801014: Add GetStubStats and related functions in GpuMemoryManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing hash specialization on win. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/gpu/gpu_memory_allocation.h ('k') | content/common/gpu/gpu_memory_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_memory_manager.h
diff --git a/content/common/gpu/gpu_memory_manager.h b/content/common/gpu/gpu_memory_manager.h
index ecab989d857a02effd9b60836fc4ac2c296484e0..21a96de0610ddd53f78c3c67d11ca3bb1da946ed 100644
--- a/content/common/gpu/gpu_memory_manager.h
+++ b/content/common/gpu/gpu_memory_manager.h
@@ -11,11 +11,24 @@
#include "base/basictypes.h"
#include "base/cancelable_callback.h"
+#include "base/hash_tables.h"
#include "base/memory/weak_ptr.h"
#include "content/common/content_export.h"
+#include "content/common/gpu/gpu_memory_allocation.h"
class GpuCommandBufferStubBase;
+#if defined(COMPILER_GCC)
+namespace BASE_HASH_NAMESPACE {
+template<>
+struct hash<GpuCommandBufferStubBase*> {
+ size_t operator()(GpuCommandBufferStubBase* ptr) const {
+ return hash<size_t>()(reinterpret_cast<size_t>(ptr));
+ }
+};
+} // namespace BASE_HASH_NAMESPACE
+#endif // COMPILER
+
class CONTENT_EXPORT GpuMemoryManagerClient {
public:
virtual ~GpuMemoryManagerClient() {}
@@ -46,6 +59,14 @@ class CONTENT_EXPORT GpuMemoryManager :
#endif
};
+ // StubMemoryStat is used to store memory-allocation-related information about
+ // a GpuCommandBufferStubBase for some time point.
+ struct StubMemoryStat {
+ bool visible;
+ GpuMemoryAllocationRequest requested_allocation;
+ GpuMemoryAllocation allocation;
+ };
+
GpuMemoryManager(GpuMemoryManagerClient* client,
size_t max_surfaces_with_frontbuffer_soft_limit);
~GpuMemoryManager();
@@ -57,6 +78,27 @@ class CONTENT_EXPORT GpuMemoryManager :
// queued delayed manage.
void ScheduleManage(bool immediate);
+ // Returns StubMemoryStat's for each GpuCommandBufferStubBase, which were
+ // assigned during the most recent call to Manage().
+ // Useful for tracking the memory-allocation-related presumed state of the
+ // system, as seen by GpuMemoryManager.
+ typedef base::hash_map<GpuCommandBufferStubBase*, StubMemoryStat>
+ StubMemoryStatMap;
+ const StubMemoryStatMap& stub_memory_stats_for_last_manage() const {
+ return stub_memory_stats_for_last_manage_;
+ }
+
+ // Tries to estimate the total available gpu memory for use by
+ // GpuMemoryManager. Ideally should consider other system applications and
+ // other internal but non GpuMemoryManager managed sources, etc.
+ size_t GetAvailableGpuMemory() const;
+
+ // GetPeakAssignedAllocationSum() will return the historical max value for the
+ // sum of all assigned client allocations (ie, peak system memory allocation).
+ size_t peak_assigned_allocation_sum() const {
+ return peak_assigned_allocation_sum_;
+ }
+
private:
friend class GpuMemoryManagerTest;
void Manage();
@@ -74,6 +116,9 @@ class CONTENT_EXPORT GpuMemoryManager :
size_t max_surfaces_with_frontbuffer_soft_limit_;
+ StubMemoryStatMap stub_memory_stats_for_last_manage_;
+ size_t peak_assigned_allocation_sum_;
+
DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager);
};
« no previous file with comments | « content/common/gpu/gpu_memory_allocation.h ('k') | content/common/gpu/gpu_memory_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698