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
3 // found in the LICENSE file.
5 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_TRACKING_H_
6 #define CONTENT_COMMON_GPU_GPU_MEMORY_TRACKING_H_
8 #include "base/basictypes.h"
9 #include "base/process/process.h"
10 #include "content/common/content_export.h"
11 #include "gpu/command_buffer/service/memory_tracking.h"
15 class GpuMemoryManager
;
17 // All decoders in a context group point to a single GpuMemoryTrackingGroup,
18 // which tracks GPU resource consumption for the entire context group.
19 class CONTENT_EXPORT GpuMemoryTrackingGroup
{
21 ~GpuMemoryTrackingGroup();
22 void TrackMemoryAllocatedChange(
25 gpu::gles2::MemoryTracker::Pool tracking_pool
);
26 bool EnsureGPUMemoryAvailable(uint64 size_needed
);
27 base::ProcessId
GetPid() const {
30 uint64
GetSize() const {
33 gpu::gles2::MemoryTracker
* GetMemoryTracker() const {
34 return memory_tracker_
;
38 friend class GpuMemoryManager
;
40 GpuMemoryTrackingGroup(base::ProcessId pid
,
41 gpu::gles2::MemoryTracker
* memory_tracker
,
42 GpuMemoryManager
* memory_manager
);
47 // Set and used only during the Manage function, to determine which
48 // non-surface clients should be hibernated.
51 gpu::gles2::MemoryTracker
* memory_tracker_
;
52 GpuMemoryManager
* memory_manager_
;
55 } // namespace content
57 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_TRACKING_H_