summaryrefslogtreecommitdiffstats
path: root/content/common/gpu/gpu_memory_tracking.h
diff options
context:
space:
mode:
authorccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-19 21:44:37 +0000
committerccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-19 21:44:37 +0000
commit879c7dfd38d69bc3cc3b4a9e7f3d8cce0743c657 (patch)
tree01961d670df2f476b0bc9a0181caa17176c3466b /content/common/gpu/gpu_memory_tracking.h
parent3c1efb517d807200d18d2a909452319b3cb37b58 (diff)
downloadchromium_src-879c7dfd38d69bc3cc3b4a9e7f3d8cce0743c657.zip
chromium_src-879c7dfd38d69bc3cc3b4a9e7f3d8cce0743c657.tar.gz
chromium_src-879c7dfd38d69bc3cc3b4a9e7f3d8cce0743c657.tar.bz2
Use a queue instead of timestamps to sort most-recently-used clients
Use a most-recently-used queue to sort the GPU memory manager clients. Previously we used timestamps, but this had issues with unit testing because of timer resolution. Maintain three lists of clients -- visible, non-visible, and non-surface clients. The visible and non-visible lists are in most-recently-used order. This removes the need to create a separate vector of the clients and sort that vector at every manage call. Store whether or not a share group has any non-hibernated clients directly in the share group's memory tracking group, so we don't have to construct an explicit set of the non-hibernated clients. BUG=164947 Review URL: https://chromiumcodereview.appspot.com/11645013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173999 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/gpu/gpu_memory_tracking.h')
-rw-r--r--content/common/gpu/gpu_memory_tracking.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/content/common/gpu/gpu_memory_tracking.h b/content/common/gpu/gpu_memory_tracking.h
index d5f4159..74131c0 100644
--- a/content/common/gpu/gpu_memory_tracking.h
+++ b/content/common/gpu/gpu_memory_tracking.h
@@ -22,6 +22,7 @@ class GpuMemoryTrackingGroup {
GpuMemoryManager* memory_manager)
: pid_(pid),
size_(0),
+ hibernated_(false),
memory_tracker_(memory_tracker),
memory_manager_(memory_manager) {
memory_manager_->AddTrackingGroup(this);
@@ -56,8 +57,14 @@ class GpuMemoryTrackingGroup {
}
private:
+ friend class GpuMemoryManager;
base::ProcessId pid_;
size_t size_;
+
+ // Set and used only during the Manage function, to determine which
+ // non-surface clients should be hibernated.
+ bool hibernated_;
+
gpu::gles2::MemoryTracker* memory_tracker_;
GpuMemoryManager* memory_manager_;
};