Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / public / common / gpu_memory_stats.h
blobfeb9ded70a3edb4d8f1c6b2d498f3adeaf86632b
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_PUBLIC_COMMON_GPU_MEMORY_STATS_H_
6 #define CONTENT_PUBLIC_COMMON_GPU_MEMORY_STATS_H_
8 // Provides access to the GPU information for the system
9 // on which chrome is currently running.
11 #include <map>
13 #include "base/basictypes.h"
14 #include "base/process/process.h"
15 #include "content/common/content_export.h"
17 namespace content {
19 struct CONTENT_EXPORT GPUVideoMemoryUsageStats {
20 GPUVideoMemoryUsageStats();
21 ~GPUVideoMemoryUsageStats();
23 struct CONTENT_EXPORT ProcessStats {
24 ProcessStats();
25 ~ProcessStats();
27 // The bytes of GPU resources accessible by this process
28 size_t video_memory;
30 // Set to true if this process' GPU resource count is inflated because
31 // it is counting other processes' resources (e.g, the GPU process has
32 // duplicate set to true because it is the aggregate of all processes)
33 bool has_duplicates;
35 typedef std::map<base::ProcessId, ProcessStats> ProcessMap;
37 // A map of processes to their GPU resource consumption
38 ProcessMap process_map;
40 // The total amount of GPU memory allocated at the time of the request.
41 size_t bytes_allocated;
43 // The maximum amount of GPU memory ever allocated at once.
44 size_t bytes_allocated_historical_max;
47 } // namespace content
49 #endif // CONTENT_PUBLIC_COMMON_GPU_MEMORY_STATS_H_