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_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/process/process.h" | 12 #include "base/process/process.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 | 14 |
15 class GURL; | 15 class GURL; |
16 | 16 |
17 namespace gpu { | 17 namespace gpu { |
18 struct GPUInfo; | 18 struct GPUInfo; |
19 } | 19 } |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class GpuDataManagerObserver; | 23 class GpuDataManagerObserver; |
24 | 24 |
25 // This class is fully thread-safe. | 25 // This class is fully thread-safe. |
26 class GpuDataManager { | 26 class GpuDataManager { |
27 public: | 27 public: |
28 typedef base::Callback<void(const std::list<base::ProcessHandle>&)> | |
29 GetGpuProcessHandlesCallback; | |
30 | |
31 // Getter for the singleton. | 28 // Getter for the singleton. |
32 CONTENT_EXPORT static GpuDataManager* GetInstance(); | 29 CONTENT_EXPORT static GpuDataManager* GetInstance(); |
33 | 30 |
34 // This is only called by extensions testing. | 31 // This is only called by extensions testing. |
35 virtual void BlacklistWebGLForTesting() = 0; | 32 virtual void BlacklistWebGLForTesting() = 0; |
36 | 33 |
37 virtual bool IsFeatureBlacklisted(int feature) const = 0; | 34 virtual bool IsFeatureBlacklisted(int feature) const = 0; |
38 virtual bool IsFeatureEnabled(int feature) const = 0; | 35 virtual bool IsFeatureEnabled(int feature) const = 0; |
39 virtual bool IsWebGLEnabled() const = 0; | 36 virtual bool IsWebGLEnabled() const = 0; |
40 | 37 |
41 virtual gpu::GPUInfo GetGPUInfo() const = 0; | 38 virtual gpu::GPUInfo GetGPUInfo() const = 0; |
42 | 39 |
43 // Retrieves a list of process handles for all gpu processes. | |
44 virtual void GetGpuProcessHandles( | |
45 const GetGpuProcessHandlesCallback& callback) const = 0; | |
46 | |
47 // This indicator might change because we could collect more GPU info or | 40 // This indicator might change because we could collect more GPU info or |
48 // because the GPU blacklist could be updated. | 41 // because the GPU blacklist could be updated. |
49 // If this returns false, any further GPU access, including launching GPU | 42 // If this returns false, any further GPU access, including launching GPU |
50 // process, establish GPU channel, and GPU info collection, should be | 43 // process, establish GPU channel, and GPU info collection, should be |
51 // blocked. | 44 // blocked. |
52 // Can be called on any thread. | 45 // Can be called on any thread. |
53 // If |reason| is not nullptr and GPU access is blocked, upon return, |reason| | 46 // If |reason| is not nullptr and GPU access is blocked, upon return, |reason| |
54 // contains a description of the reason why GPU access is blocked. | 47 // contains a description of the reason why GPU access is blocked. |
55 virtual bool GpuAccessAllowed(std::string* reason) const = 0; | 48 virtual bool GpuAccessAllowed(std::string* reason) const = 0; |
56 | 49 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // the backlists decision and applying commandline switches. | 101 // the backlists decision and applying commandline switches. |
109 virtual void SetGpuInfo(const gpu::GPUInfo& gpu_info) = 0; | 102 virtual void SetGpuInfo(const gpu::GPUInfo& gpu_info) = 0; |
110 | 103 |
111 protected: | 104 protected: |
112 virtual ~GpuDataManager() {} | 105 virtual ~GpuDataManager() {} |
113 }; | 106 }; |
114 | 107 |
115 }; // namespace content | 108 }; // namespace content |
116 | 109 |
117 #endif // CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ | 110 #endif // CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ |
OLD | NEW |