Mac Remote CoreAnimation: Fix flashing at tab-switch
[chromium-blink-merge.git] / content / common / gpu / gpu_memory_tracking.h
blobbd0b400a44c22898b75df50b5da917eb0e486195
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"
13 namespace content {
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 {
20 public:
21 ~GpuMemoryTrackingGroup();
22 void TrackMemoryAllocatedChange(
23 uint64 old_size,
24 uint64 new_size,
25 gpu::gles2::MemoryTracker::Pool tracking_pool);
26 bool EnsureGPUMemoryAvailable(uint64 size_needed);
27 base::ProcessId GetPid() const {
28 return pid_;
30 uint64 GetSize() const {
31 return size_;
33 gpu::gles2::MemoryTracker* GetMemoryTracker() const {
34 return memory_tracker_;
37 private:
38 friend class GpuMemoryManager;
40 GpuMemoryTrackingGroup(base::ProcessId pid,
41 gpu::gles2::MemoryTracker* memory_tracker,
42 GpuMemoryManager* memory_manager);
44 base::ProcessId pid_;
45 uint64 size_;
47 // Set and used only during the Manage function, to determine which
48 // non-surface clients should be hibernated.
49 bool hibernated_;
51 gpu::gles2::MemoryTracker* memory_tracker_;
52 GpuMemoryManager* memory_manager_;
55 } // namespace content
57 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_TRACKING_H_