diff options
author | ccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-24 23:34:45 +0000 |
---|---|---|
committer | ccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-24 23:34:45 +0000 |
commit | 931989fdce2fae066fb260e21b53f66676a7f678 (patch) | |
tree | 400010e086886d2e327354866f0be93dffbdd403 /content/common/gpu/gpu_memory_tracking.h | |
parent | 1e37e6f0954da6ec2bb43d42f654bbe74b3b88df (diff) | |
download | chromium_src-931989fdce2fae066fb260e21b53f66676a7f678.zip chromium_src-931989fdce2fae066fb260e21b53f66676a7f678.tar.gz chromium_src-931989fdce2fae066fb260e21b53f66676a7f678.tar.bz2 |
Move GpuMemoryManager::ClientState structure to its own class.
Also clean up initialization path so that the GpuMemoryManager returns
a GpuMemoryManagerClientState, and destroying that structure deletes
the client.
BUG=164947
Review URL: https://chromiumcodereview.appspot.com/11571075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174591 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/gpu/gpu_memory_tracking.h')
-rw-r--r-- | content/common/gpu/gpu_memory_tracking.h | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/content/common/gpu/gpu_memory_tracking.h b/content/common/gpu/gpu_memory_tracking.h index 74131c0..36ae861 100644 --- a/content/common/gpu/gpu_memory_tracking.h +++ b/content/common/gpu/gpu_memory_tracking.h @@ -8,44 +8,23 @@ #if defined(ENABLE_GPU) #include "base/basictypes.h" -#include "content/common/gpu/gpu_memory_manager.h" +#include "base/process.h" +#include "content/common/content_export.h" #include "gpu/command_buffer/service/memory_tracking.h" namespace content { +class GpuMemoryManager; + // All decoders in a context group point to a single GpuMemoryTrackingGroup, // which tracks GPU resource consumption for the entire context group. -class GpuMemoryTrackingGroup { +class CONTENT_EXPORT GpuMemoryTrackingGroup { public: - GpuMemoryTrackingGroup(base::ProcessId pid, - gpu::gles2::MemoryTracker* memory_tracker, - GpuMemoryManager* memory_manager) - : pid_(pid), - size_(0), - hibernated_(false), - memory_tracker_(memory_tracker), - memory_manager_(memory_manager) { - memory_manager_->AddTrackingGroup(this); - } - ~GpuMemoryTrackingGroup() { - memory_manager_->RemoveTrackingGroup(this); - } + ~GpuMemoryTrackingGroup(); void TrackMemoryAllocatedChange( size_t old_size, size_t new_size, - gpu::gles2::MemoryTracker::Pool tracking_pool) { - if (old_size < new_size) { - size_t delta = new_size - old_size; - size_ += delta; - } - if (new_size < old_size) { - size_t delta = old_size - new_size; - DCHECK(size_ >= delta); - size_ -= delta; - } - memory_manager_->TrackMemoryAllocatedChange( - old_size, new_size, tracking_pool); - } + gpu::gles2::MemoryTracker::Pool tracking_pool); base::ProcessId GetPid() const { return pid_; } @@ -58,6 +37,11 @@ class GpuMemoryTrackingGroup { private: friend class GpuMemoryManager; + + GpuMemoryTrackingGroup(base::ProcessId pid, + gpu::gles2::MemoryTracker* memory_tracker, + GpuMemoryManager* memory_manager); + base::ProcessId pid_; size_t size_; |