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 #ifndef CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ |
6 #define CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ | 6 #define CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
15 #include "base/observer_list_threadsafe.h" | 15 #include "base/observer_list_threadsafe.h" |
16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "content/public/browser/gpu_data_manager.h" | 18 #include "content/public/browser/gpu_data_manager.h" |
19 #include "content/public/common/gpu_info.h" | 19 #include "content/public/common/gpu_info.h" |
| 20 #include "content/public/common/gpu_memory_stats.h" |
20 | 21 |
21 class CommandLine; | 22 class CommandLine; |
22 | 23 |
23 class CONTENT_EXPORT GpuDataManagerImpl | 24 class CONTENT_EXPORT GpuDataManagerImpl |
24 : public NON_EXPORTED_BASE(content::GpuDataManager) { | 25 : public NON_EXPORTED_BASE(content::GpuDataManager) { |
25 public: | 26 public: |
26 // Getter for the singleton. This will return NULL on failure. | 27 // Getter for the singleton. This will return NULL on failure. |
27 static GpuDataManagerImpl* GetInstance(); | 28 static GpuDataManagerImpl* GetInstance(); |
28 | 29 |
29 // GpuDataManager implementation. | 30 // GpuDataManager implementation. |
30 virtual content::GpuFeatureType GetGpuFeatureType() OVERRIDE; | 31 virtual content::GpuFeatureType GetGpuFeatureType() OVERRIDE; |
31 virtual void SetGpuFeatureType(content::GpuFeatureType feature_type) OVERRIDE; | 32 virtual void SetGpuFeatureType(content::GpuFeatureType feature_type) OVERRIDE; |
32 virtual content::GPUInfo GetGPUInfo() const OVERRIDE; | 33 virtual content::GPUInfo GetGPUInfo() const OVERRIDE; |
33 virtual bool GpuAccessAllowed() OVERRIDE; | 34 virtual bool GpuAccessAllowed() OVERRIDE; |
34 virtual void RequestCompleteGpuInfoIfNeeded() OVERRIDE; | 35 virtual void RequestCompleteGpuInfoIfNeeded() OVERRIDE; |
35 virtual bool IsCompleteGPUInfoAvailable() const OVERRIDE; | 36 virtual bool IsCompleteGPUInfoAvailable() const OVERRIDE; |
| 37 virtual void RequestVideoMemoryUsageStatsUpdate() OVERRIDE; |
36 virtual bool ShouldUseSoftwareRendering() OVERRIDE; | 38 virtual bool ShouldUseSoftwareRendering() OVERRIDE; |
37 virtual void RegisterSwiftShaderPath(const FilePath& path) OVERRIDE; | 39 virtual void RegisterSwiftShaderPath(const FilePath& path) OVERRIDE; |
38 virtual const base::ListValue& GetLogMessages() const OVERRIDE; | 40 virtual const base::ListValue& GetLogMessages() const OVERRIDE; |
39 virtual void AddObserver(content::GpuDataManagerObserver* observer) OVERRIDE; | 41 virtual void AddObserver(content::GpuDataManagerObserver* observer) OVERRIDE; |
40 virtual void RemoveObserver( | 42 virtual void RemoveObserver( |
41 content::GpuDataManagerObserver* observer) OVERRIDE; | 43 content::GpuDataManagerObserver* observer) OVERRIDE; |
42 | 44 |
43 // Only update if the current GPUInfo is not finalized. | 45 // Only update if the current GPUInfo is not finalized. |
44 void UpdateGpuInfo(const content::GPUInfo& gpu_info); | 46 void UpdateGpuInfo(const content::GPUInfo& gpu_info); |
45 | 47 |
| 48 void UpdateVideoMemoryUsageStats( |
| 49 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats); |
| 50 |
46 void AddLogMessage(Value* msg); | 51 void AddLogMessage(Value* msg); |
47 | 52 |
48 // Insert disable-feature switches corresponding to preliminary gpu feature | 53 // Insert disable-feature switches corresponding to preliminary gpu feature |
49 // flags into the renderer process command line. | 54 // flags into the renderer process command line. |
50 void AppendRendererCommandLine(CommandLine* command_line); | 55 void AppendRendererCommandLine(CommandLine* command_line); |
51 | 56 |
52 // Insert switches into gpu process command line: kUseGL, | 57 // Insert switches into gpu process command line: kUseGL, |
53 // kDisableGLMultisampling. | 58 // kDisableGLMultisampling. |
54 void AppendGpuCommandLine(CommandLine* command_line); | 59 void AppendGpuCommandLine(CommandLine* command_line); |
55 | 60 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 FilePath swiftshader_path_; | 117 FilePath swiftshader_path_; |
113 | 118 |
114 // Current card force-blacklisted due to GPU crashes, or disabled through | 119 // Current card force-blacklisted due to GPU crashes, or disabled through |
115 // the --disable-gpu commandline switch. | 120 // the --disable-gpu commandline switch. |
116 bool card_blacklisted_; | 121 bool card_blacklisted_; |
117 | 122 |
118 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); | 123 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); |
119 }; | 124 }; |
120 | 125 |
121 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ | 126 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ |
OLD | NEW |