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 #include "content/common/gpu/gpu_memory_tracking.h" | 5 #include "content/common/gpu/gpu_memory_tracking.h" |
6 | 6 |
7 #if defined(ENABLE_GPU) | |
8 | |
9 #include "content/common/gpu/gpu_memory_manager.h" | 7 #include "content/common/gpu/gpu_memory_manager.h" |
10 | 8 |
11 namespace content { | 9 namespace content { |
12 | 10 |
13 GpuMemoryTrackingGroup::GpuMemoryTrackingGroup( | 11 GpuMemoryTrackingGroup::GpuMemoryTrackingGroup( |
14 base::ProcessId pid, | 12 base::ProcessId pid, |
15 gpu::gles2::MemoryTracker* memory_tracker, | 13 gpu::gles2::MemoryTracker* memory_tracker, |
16 GpuMemoryManager* memory_manager) | 14 GpuMemoryManager* memory_manager) |
17 : pid_(pid), | 15 : pid_(pid), |
18 size_(0), | 16 size_(0), |
19 hibernated_(false), | 17 hibernated_(false), |
20 memory_tracker_(memory_tracker), | 18 memory_tracker_(memory_tracker), |
21 memory_manager_(memory_manager) { | 19 memory_manager_(memory_manager) { |
22 } | 20 } |
23 | 21 |
24 GpuMemoryTrackingGroup::~GpuMemoryTrackingGroup() { | 22 GpuMemoryTrackingGroup::~GpuMemoryTrackingGroup() { |
25 memory_manager_->OnDestroyTrackingGroup(this); | 23 memory_manager_->OnDestroyTrackingGroup(this); |
26 } | 24 } |
27 | 25 |
28 void GpuMemoryTrackingGroup::TrackMemoryAllocatedChange( | 26 void GpuMemoryTrackingGroup::TrackMemoryAllocatedChange( |
29 size_t old_size, | 27 size_t old_size, |
30 size_t new_size, | 28 size_t new_size, |
31 gpu::gles2::MemoryTracker::Pool tracking_pool) { | 29 gpu::gles2::MemoryTracker::Pool tracking_pool) { |
32 memory_manager_->TrackMemoryAllocatedChange( | 30 memory_manager_->TrackMemoryAllocatedChange( |
33 this, old_size, new_size, tracking_pool); | 31 this, old_size, new_size, tracking_pool); |
34 } | 32 } |
35 | 33 |
36 } // namespace content | 34 } // namespace content |
37 | |
38 #endif | |
OLD | NEW |