Re-enable index-basics-workers test to see if still times
[chromium-blink-merge.git] / content / public / browser / gpu_data_manager.h
blobf76907aa4c403370e50561aba2f1e1948eea9d28
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.h"
13 #include "content/common/content_export.h"
15 class GURL;
17 namespace base {
18 class FilePath;
19 class ListValue;
22 namespace content {
24 class GpuDataManagerObserver;
25 struct GPUInfo;
27 // This class is fully thread-safe.
28 class GpuDataManager {
29 public:
30 typedef base::Callback<void(const std::list<base::ProcessHandle>&)>
31 GetGpuProcessHandlesCallback;
33 // Getter for the singleton.
34 CONTENT_EXPORT static GpuDataManager* GetInstance();
36 virtual void InitializeForTesting(const std::string& gpu_blacklist_json,
37 const content::GPUInfo& gpu_info) = 0;
39 virtual bool IsFeatureBlacklisted(int feature) const = 0;
41 virtual GPUInfo GetGPUInfo() const = 0;
43 // Retrieves a list of process handles for all gpu processes.
44 virtual void GetGpuProcessHandles(
45 const GetGpuProcessHandlesCallback& callback) const = 0;
47 // This indicator might change because we could collect more GPU info or
48 // because the GPU blacklist could be updated.
49 // If this returns false, any further GPU access, including launching GPU
50 // process, establish GPU channel, and GPU info collection, should be
51 // blocked.
52 // Can be called on any thread.
53 // If |reason| is not NULL and GPU access is blocked, upon return, |reason|
54 // contains a description of the reason why GPU access is blocked.
55 virtual bool GpuAccessAllowed(std::string* reason) const = 0;
57 // Requests complete GPUinfo if it has not already been requested
58 virtual void RequestCompleteGpuInfoIfNeeded() = 0;
60 virtual bool IsCompleteGpuInfoAvailable() const = 0;
62 // Requests that the GPU process report its current video memory usage stats,
63 // which can be retrieved via the GPU data manager's on-update function.
64 virtual void RequestVideoMemoryUsageStatsUpdate() const = 0;
66 // Returns true if SwiftShader should be used.
67 virtual bool ShouldUseSwiftShader() const = 0;
69 // Register a path to SwiftShader.
70 virtual void RegisterSwiftShaderPath(const base::FilePath& path) = 0;
72 // Registers/unregister |observer|.
73 virtual void AddObserver(GpuDataManagerObserver* observer) = 0;
74 virtual void RemoveObserver(GpuDataManagerObserver* observer) = 0;
76 // Allows a given domain previously blocked from accessing 3D APIs
77 // to access them again.
78 virtual void UnblockDomainFrom3DAPIs(const GURL& url) = 0;
80 // Disable the gpu process watchdog thread.
81 virtual void DisableGpuWatchdog() = 0;
83 // Set GL strings. This triggers a re-calculation of GPU blacklist
84 // decision.
85 virtual void SetGLStrings(const std::string& gl_vendor,
86 const std::string& gl_renderer,
87 const std::string& gl_version) = 0;
89 // Obtain collected GL strings.
90 virtual void GetGLStrings(std::string* gl_vendor,
91 std::string* gl_renderer,
92 std::string* gl_version) = 0;
94 // Turn off all hardware acceleration.
95 virtual void DisableHardwareAcceleration() = 0;
97 protected:
98 virtual ~GpuDataManager() {}
101 }; // namespace content
103 #endif // CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_