Make USB permissions work in the new permission message system
[chromium-blink-merge.git] / content / browser / gpu / gpu_data_manager_impl.cc
blob0d665d1fda28cef5932b6fcbdd0c67dd3e97a5d9
1 // Copyright (c) 2013 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 #include "content/browser/gpu/gpu_data_manager_impl.h"
7 #include "content/browser/gpu/gpu_data_manager_impl_private.h"
9 namespace content {
11 // static
12 GpuDataManager* GpuDataManager::GetInstance() {
13 return GpuDataManagerImpl::GetInstance();
16 // static
17 GpuDataManagerImpl* GpuDataManagerImpl::GetInstance() {
18 return Singleton<GpuDataManagerImpl>::get();
21 void GpuDataManagerImpl::InitializeForTesting(
22 const std::string& gpu_blacklist_json, const gpu::GPUInfo& gpu_info) {
23 base::AutoLock auto_lock(lock_);
24 private_->InitializeForTesting(gpu_blacklist_json, gpu_info);
27 bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const {
28 base::AutoLock auto_lock(lock_);
29 return private_->IsFeatureBlacklisted(feature);
32 bool GpuDataManagerImpl::IsDriverBugWorkaroundActive(int feature) const {
33 base::AutoLock auto_lock(lock_);
34 return private_->IsDriverBugWorkaroundActive(feature);
37 gpu::GPUInfo GpuDataManagerImpl::GetGPUInfo() const {
38 base::AutoLock auto_lock(lock_);
39 return private_->GetGPUInfo();
42 void GpuDataManagerImpl::GetGpuProcessHandles(
43 const GetGpuProcessHandlesCallback& callback) const {
44 base::AutoLock auto_lock(lock_);
45 private_->GetGpuProcessHandles(callback);
48 bool GpuDataManagerImpl::GpuAccessAllowed(std::string* reason) const {
49 base::AutoLock auto_lock(lock_);
50 return private_->GpuAccessAllowed(reason);
53 void GpuDataManagerImpl::RequestCompleteGpuInfoIfNeeded() {
54 base::AutoLock auto_lock(lock_);
55 private_->RequestCompleteGpuInfoIfNeeded();
58 bool GpuDataManagerImpl::IsEssentialGpuInfoAvailable() const {
59 base::AutoLock auto_lock(lock_);
60 return private_->IsEssentialGpuInfoAvailable();
63 bool GpuDataManagerImpl::IsCompleteGpuInfoAvailable() const {
64 base::AutoLock auto_lock(lock_);
65 return private_->IsCompleteGpuInfoAvailable();
68 void GpuDataManagerImpl::RequestVideoMemoryUsageStatsUpdate() const {
69 base::AutoLock auto_lock(lock_);
70 private_->RequestVideoMemoryUsageStatsUpdate();
73 bool GpuDataManagerImpl::ShouldUseSwiftShader() const {
74 base::AutoLock auto_lock(lock_);
75 return private_->ShouldUseSwiftShader();
78 void GpuDataManagerImpl::RegisterSwiftShaderPath(
79 const base::FilePath& path) {
80 base::AutoLock auto_lock(lock_);
81 private_->RegisterSwiftShaderPath(path);
84 bool GpuDataManagerImpl::ShouldUseWarp() const {
85 base::AutoLock auto_lock(lock_);
86 return private_->ShouldUseWarp();
89 void GpuDataManagerImpl::AddObserver(
90 GpuDataManagerObserver* observer) {
91 base::AutoLock auto_lock(lock_);
92 private_->AddObserver(observer);
95 void GpuDataManagerImpl::RemoveObserver(
96 GpuDataManagerObserver* observer) {
97 base::AutoLock auto_lock(lock_);
98 private_->RemoveObserver(observer);
101 void GpuDataManagerImpl::UnblockDomainFrom3DAPIs(const GURL& url) {
102 base::AutoLock auto_lock(lock_);
103 private_->UnblockDomainFrom3DAPIs(url);
106 void GpuDataManagerImpl::DisableGpuWatchdog() {
107 base::AutoLock auto_lock(lock_);
108 private_->DisableGpuWatchdog();
111 void GpuDataManagerImpl::SetGLStrings(const std::string& gl_vendor,
112 const std::string& gl_renderer,
113 const std::string& gl_version) {
114 base::AutoLock auto_lock(lock_);
115 private_->SetGLStrings(gl_vendor, gl_renderer, gl_version);
118 void GpuDataManagerImpl::GetGLStrings(std::string* gl_vendor,
119 std::string* gl_renderer,
120 std::string* gl_version) {
121 base::AutoLock auto_lock(lock_);
122 private_->GetGLStrings(gl_vendor, gl_renderer, gl_version);
125 void GpuDataManagerImpl::DisableHardwareAcceleration() {
126 base::AutoLock auto_lock(lock_);
127 private_->DisableHardwareAcceleration();
130 bool GpuDataManagerImpl::CanUseGpuBrowserCompositor() const {
131 base::AutoLock auto_lock(lock_);
132 return private_->CanUseGpuBrowserCompositor();
135 void GpuDataManagerImpl::GetDisabledExtensions(
136 std::string* disabled_extensions) const {
137 base::AutoLock auto_lock(lock_);
138 private_->GetDisabledExtensions(disabled_extensions);
141 void GpuDataManagerImpl::Initialize() {
142 base::AutoLock auto_lock(lock_);
143 private_->Initialize();
146 void GpuDataManagerImpl::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) {
147 base::AutoLock auto_lock(lock_);
148 private_->UpdateGpuInfo(gpu_info);
151 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats(
152 const GPUVideoMemoryUsageStats& video_memory_usage_stats) {
153 base::AutoLock auto_lock(lock_);
154 private_->UpdateVideoMemoryUsageStats(video_memory_usage_stats);
157 void GpuDataManagerImpl::AppendRendererCommandLine(
158 base::CommandLine* command_line) const {
159 base::AutoLock auto_lock(lock_);
160 private_->AppendRendererCommandLine(command_line);
163 void GpuDataManagerImpl::AppendGpuCommandLine(
164 base::CommandLine* command_line) const {
165 base::AutoLock auto_lock(lock_);
166 private_->AppendGpuCommandLine(command_line);
169 void GpuDataManagerImpl::AppendPluginCommandLine(
170 base::CommandLine* command_line) const {
171 base::AutoLock auto_lock(lock_);
172 private_->AppendPluginCommandLine(command_line);
175 void GpuDataManagerImpl::UpdateRendererWebPrefs(
176 WebPreferences* prefs) const {
177 base::AutoLock auto_lock(lock_);
178 private_->UpdateRendererWebPrefs(prefs);
181 std::string GpuDataManagerImpl::GetBlacklistVersion() const {
182 base::AutoLock auto_lock(lock_);
183 return private_->GetBlacklistVersion();
186 std::string GpuDataManagerImpl::GetDriverBugListVersion() const {
187 base::AutoLock auto_lock(lock_);
188 return private_->GetDriverBugListVersion();
191 void GpuDataManagerImpl::GetBlacklistReasons(base::ListValue* reasons) const {
192 base::AutoLock auto_lock(lock_);
193 private_->GetBlacklistReasons(reasons);
196 std::vector<std::string> GpuDataManagerImpl::GetDriverBugWorkarounds() const {
197 base::AutoLock auto_lock(lock_);
198 return private_->GetDriverBugWorkarounds();
201 void GpuDataManagerImpl::AddLogMessage(int level,
202 const std::string& header,
203 const std::string& message) {
204 base::AutoLock auto_lock(lock_);
205 private_->AddLogMessage(level, header, message);
208 void GpuDataManagerImpl::ProcessCrashed(
209 base::TerminationStatus exit_code) {
210 base::AutoLock auto_lock(lock_);
211 private_->ProcessCrashed(exit_code);
214 base::ListValue* GpuDataManagerImpl::GetLogMessages() const {
215 base::AutoLock auto_lock(lock_);
216 return private_->GetLogMessages();
219 void GpuDataManagerImpl::HandleGpuSwitch() {
220 base::AutoLock auto_lock(lock_);
221 private_->HandleGpuSwitch();
224 void GpuDataManagerImpl::BlockDomainFrom3DAPIs(
225 const GURL& url, DomainGuilt guilt) {
226 base::AutoLock auto_lock(lock_);
227 private_->BlockDomainFrom3DAPIs(url, guilt);
230 bool GpuDataManagerImpl::Are3DAPIsBlocked(const GURL& url,
231 int render_process_id,
232 int render_view_id,
233 ThreeDAPIType requester) {
234 base::AutoLock auto_lock(lock_);
235 return private_->Are3DAPIsBlocked(
236 url, render_process_id, render_view_id, requester);
239 void GpuDataManagerImpl::DisableDomainBlockingFor3DAPIsForTesting() {
240 base::AutoLock auto_lock(lock_);
241 private_->DisableDomainBlockingFor3DAPIsForTesting();
244 size_t GpuDataManagerImpl::GetBlacklistedFeatureCount() const {
245 base::AutoLock auto_lock(lock_);
246 return private_->GetBlacklistedFeatureCount();
249 void GpuDataManagerImpl::SetDisplayCount(unsigned int display_count) {
250 base::AutoLock auto_lock(lock_);
251 private_->SetDisplayCount(display_count);
254 unsigned int GpuDataManagerImpl::GetDisplayCount() const {
255 base::AutoLock auto_lock(lock_);
256 return private_->GetDisplayCount();
259 bool GpuDataManagerImpl::UpdateActiveGpu(uint32 vendor_id, uint32 device_id) {
260 base::AutoLock auto_lock(lock_);
261 return private_->UpdateActiveGpu(vendor_id, device_id);
264 void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& url,
265 int render_process_id,
266 int render_view_id,
267 ThreeDAPIType requester) {
268 base::AutoLock auto_lock(lock_);
269 private_->Notify3DAPIBlocked(
270 url, render_process_id, render_view_id, requester);
273 void GpuDataManagerImpl::OnGpuProcessInitFailure() {
274 base::AutoLock auto_lock(lock_);
275 private_->OnGpuProcessInitFailure();
278 GpuDataManagerImpl::GpuDataManagerImpl()
279 : private_(GpuDataManagerImplPrivate::Create(this)) {
282 GpuDataManagerImpl::~GpuDataManagerImpl() {
285 } // namespace content