Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: gpu/ipc/service/gpu_memory_manager.h

Issue 1846253003: Revert of Refactor content/common/gpu into gpu/ipc/service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef GPU_IPC_SERVICE_GPU_MEMORY_MANAGER_H_
6 #define GPU_IPC_SERVICE_GPU_MEMORY_MANAGER_H_
7
8 #include <stdint.h>
9
10 #include <list>
11 #include <map>
12
13 #include "base/cancelable_callback.h"
14 #include "base/containers/hash_tables.h"
15 #include "base/gtest_prod_util.h"
16 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h"
18 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
19 #include "gpu/command_buffer/service/memory_tracking.h"
20 #include "gpu/gpu_export.h"
21
22 namespace gpu {
23
24 class GpuChannelManager;
25 class GpuMemoryTrackingGroup;
26 struct VideoMemoryUsageStats;
27
28 class GPU_EXPORT GpuMemoryManager :
29 public base::SupportsWeakPtr<GpuMemoryManager> {
30 public:
31 explicit GpuMemoryManager(GpuChannelManager* channel_manager);
32 ~GpuMemoryManager();
33
34 // Retrieve GPU Resource consumption statistics for the task manager
35 void GetVideoMemoryUsageStats(
36 VideoMemoryUsageStats* video_memory_usage_stats) const;
37
38 GpuMemoryTrackingGroup* CreateTrackingGroup(
39 base::ProcessId pid, gles2::MemoryTracker* memory_tracker);
40
41 uint64_t GetTrackerMemoryUsage(gles2::MemoryTracker* tracker) const;
42
43 private:
44 friend class GpuMemoryManagerTest;
45 friend class GpuMemoryTrackingGroup;
46 friend class GpuMemoryManagerClientState;
47
48 typedef std::map<gles2::MemoryTracker*, GpuMemoryTrackingGroup*>
49 TrackingGroupMap;
50
51 // Send memory usage stats to the browser process.
52 void SendUmaStatsToHost();
53
54 // Get the current number of bytes allocated.
55 uint64_t GetCurrentUsage() const { return bytes_allocated_current_; }
56
57 // GpuMemoryTrackingGroup interface
58 void TrackMemoryAllocatedChange(GpuMemoryTrackingGroup* tracking_group,
59 uint64_t old_size,
60 uint64_t new_size);
61 void OnDestroyTrackingGroup(GpuMemoryTrackingGroup* tracking_group);
62 bool EnsureGPUMemoryAvailable(uint64_t size_needed);
63
64 GpuChannelManager* channel_manager_;
65
66 // All context groups' tracking structures
67 TrackingGroupMap tracking_groups_;
68
69 // The current total memory usage, and historical maximum memory usage
70 uint64_t bytes_allocated_current_;
71 uint64_t bytes_allocated_historical_max_;
72
73 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager);
74 };
75
76 } // namespace gpu
77
78 #endif // GPU_IPC_SERVICE_GPU_MEMORY_MANAGER_H_
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_memory_buffer_factory_test_template.h ('k') | gpu/ipc/service/gpu_memory_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698