blob: 3159adb9351e20bd7691954404d0a786be9bd7b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_
#define CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_
#include <list>
#include <string>
#include "base/process.h"
#include "content/common/content_export.h"
#include "content/public/common/gpu_feature_type.h"
#include "content/public/common/gpu_switching_option.h"
class FilePath;
class GURL;
namespace base {
class ListValue;
}
namespace content {
class GpuDataManagerObserver;
struct GPUInfo;
// This class is fully thread-safe.
class GpuDataManager {
public:
typedef base::Callback<void(const std::list<base::ProcessHandle>&)>
GetGpuProcessHandlesCallback;
// Getter for the singleton.
CONTENT_EXPORT static GpuDataManager* GetInstance();
virtual void InitializeForTesting(const std::string& gpu_blacklist_json,
const content::GPUInfo& gpu_info) = 0;
virtual std::string GetBlacklistVersion() const = 0;
virtual GpuFeatureType GetBlacklistedFeatures() const = 0;
virtual GpuSwitchingOption GetGpuSwitchingOption() const = 0;
// Returns the reasons for the latest run of blacklisting decisions.
// For the structure of returned value, see documentation for
// GpuBlacklist::GetBlacklistedReasons().
// Caller is responsible to release the returned value.
virtual base::ListValue* GetBlacklistReasons() const = 0;
virtual GPUInfo GetGPUInfo() const = 0;
// Retrieves a list of process handles for all gpu processes.
virtual void GetGpuProcessHandles(
const GetGpuProcessHandlesCallback& callback) const = 0;
// This indicator might change because we could collect more GPU info or
// because the GPU blacklist could be updated.
// If this returns false, any further GPU access, including launching GPU
// process, establish GPU channel, and GPU info collection, should be
// blocked.
// Can be called on any thread.
virtual bool GpuAccessAllowed() const = 0;
// Requests complete GPUinfo if it has not already been requested
virtual void RequestCompleteGpuInfoIfNeeded() = 0;
virtual bool IsCompleteGpuInfoAvailable() const = 0;
// Requests that the GPU process report its current video memory usage stats,
// which can be retrieved via the GPU data manager's on-update function.
virtual void RequestVideoMemoryUsageStatsUpdate() const = 0;
// Returns true if the software rendering should currently be used.
virtual bool ShouldUseSoftwareRendering() const = 0;
// Register a path to the SwiftShader software renderer.
virtual void RegisterSwiftShaderPath(const FilePath& path) = 0;
virtual void AddLogMessage(
int level, const std::string& header, const std::string& message) = 0;
// Returns a new copy of the ListValue. Caller is responsible to release
// the returned value.
virtual base::ListValue* GetLogMessages() const = 0;
// Registers/unregister |observer|.
virtual void AddObserver(GpuDataManagerObserver* observer) = 0;
virtual void RemoveObserver(GpuDataManagerObserver* observer) = 0;
// Notifies the gpu process about the number of browser windows, so
// they can be used to determine managed memory allocation.
virtual void SetWindowCount(uint32 count) = 0;
virtual uint32 GetWindowCount() const = 0;
// Allows a given domain previously blocked from accessing 3D APIs
// to access them again.
virtual void UnblockDomainFrom3DAPIs(const GURL& url) = 0;
// Disables domain blocking for 3D APIs. For use only in tests.
virtual void DisableDomainBlockingFor3DAPIsForTesting() = 0;
// Disable the gpu process watchdog thread.
virtual void DisableGpuWatchdog() = 0;
protected:
virtual ~GpuDataManager() {}
};
}; // namespace content
#endif // CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_
|