Content settings: remove some plugin-related code/resources when... there are no...
[chromium-blink-merge.git] / content / public / browser / gpu_data_manager.h
blob4991a4e6fdfd1d4d4ca22055b0bf27e7fff6a937
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_BROWSER_GPU_DATA_MANAGER_H_
6 #define CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_
8 #include <list>
9 #include <string>
11 #include "base/callback_forward.h"
12 #include "base/process/process.h"
13 #include "content/common/content_export.h"
15 class GURL;
17 namespace base {
18 class FilePath;
19 class ListValue;
22 namespace gpu {
23 struct GPUInfo;
26 namespace content {
28 class GpuDataManagerObserver;
30 // This class is fully thread-safe.
31 class GpuDataManager {
32 public:
33 typedef base::Callback<void(const std::list<base::ProcessHandle>&)>
34 GetGpuProcessHandlesCallback;
36 // Getter for the singleton.
37 CONTENT_EXPORT static GpuDataManager* GetInstance();
39 virtual void InitializeForTesting(const std::string& gpu_blacklist_json,
40 const gpu::GPUInfo& gpu_info) = 0;
42 virtual bool IsFeatureBlacklisted(int feature) const = 0;
44 virtual gpu::GPUInfo GetGPUInfo() const = 0;
46 // Retrieves a list of process handles for all gpu processes.
47 virtual void GetGpuProcessHandles(
48 const GetGpuProcessHandlesCallback& callback) const = 0;
50 // This indicator might change because we could collect more GPU info or
51 // because the GPU blacklist could be updated.
52 // If this returns false, any further GPU access, including launching GPU
53 // process, establish GPU channel, and GPU info collection, should be
54 // blocked.
55 // Can be called on any thread.
56 // If |reason| is not nullptr and GPU access is blocked, upon return, |reason|
57 // contains a description of the reason why GPU access is blocked.
58 virtual bool GpuAccessAllowed(std::string* reason) const = 0;
60 // Requests complete GPU info if it has not already been requested
61 virtual void RequestCompleteGpuInfoIfNeeded() = 0;
63 // Check if basic and context GPU info have been collected.
64 virtual bool IsEssentialGpuInfoAvailable() const = 0;
66 // On Windows, besides basic and context GPU info, it also checks if
67 // DxDiagnostics have been collected.
68 // On other platforms, it's the same as IsEsentialGpuInfoAvailable().
69 virtual bool IsCompleteGpuInfoAvailable() const = 0;
71 // Requests that the GPU process report its current video memory usage stats,
72 // which can be retrieved via the GPU data manager's on-update function.
73 virtual void RequestVideoMemoryUsageStatsUpdate() const = 0;
75 // Returns true if SwiftShader should be used.
76 virtual bool ShouldUseSwiftShader() const = 0;
78 // Register a path to SwiftShader.
79 virtual void RegisterSwiftShaderPath(const base::FilePath& path) = 0;
81 // Returns current state about WARP, which may be due to command-line
82 // arguments or saved state.
83 virtual bool ShouldUseWarp() const = 0;
85 // Registers/unregister |observer|.
86 virtual void AddObserver(GpuDataManagerObserver* observer) = 0;
87 virtual void RemoveObserver(GpuDataManagerObserver* observer) = 0;
89 // Allows a given domain previously blocked from accessing 3D APIs
90 // to access them again.
91 virtual void UnblockDomainFrom3DAPIs(const GURL& url) = 0;
93 // Disable the gpu process watchdog thread.
94 virtual void DisableGpuWatchdog() = 0;
96 // Set GL strings. This triggers a re-calculation of GPU blacklist
97 // decision.
98 virtual void SetGLStrings(const std::string& gl_vendor,
99 const std::string& gl_renderer,
100 const std::string& gl_version) = 0;
102 // Obtain collected GL strings.
103 virtual void GetGLStrings(std::string* gl_vendor,
104 std::string* gl_renderer,
105 std::string* gl_version) = 0;
107 // Turn off all hardware acceleration.
108 virtual void DisableHardwareAcceleration() = 0;
110 // Whether the browser compositor can be used.
111 virtual bool CanUseGpuBrowserCompositor() const = 0;
113 // Extensions that are currently disabled.
114 virtual void GetDisabledExtensions(
115 std::string* disabled_extensions) const = 0;
117 protected:
118 virtual ~GpuDataManager() {}
121 }; // namespace content
123 #endif // CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_