Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / browser / gpu / gpu_data_manager_impl.cc
blob93d15c71108018c1f031eac30f6475ef78ee48d6
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::IsCompleteGpuInfoAvailable() const {
59 base::AutoLock auto_lock(lock_);
60 return private_->IsCompleteGpuInfoAvailable();
63 void GpuDataManagerImpl::RequestVideoMemoryUsageStatsUpdate() const {
64 base::AutoLock auto_lock(lock_);
65 private_->RequestVideoMemoryUsageStatsUpdate();
68 bool GpuDataManagerImpl::ShouldUseSwiftShader() const {
69 base::AutoLock auto_lock(lock_);
70 return private_->ShouldUseSwiftShader();
73 void GpuDataManagerImpl::RegisterSwiftShaderPath(
74 const base::FilePath& path) {
75 base::AutoLock auto_lock(lock_);
76 private_->RegisterSwiftShaderPath(path);
79 void GpuDataManagerImpl::AddObserver(
80 GpuDataManagerObserver* observer) {
81 base::AutoLock auto_lock(lock_);
82 private_->AddObserver(observer);
85 void GpuDataManagerImpl::RemoveObserver(
86 GpuDataManagerObserver* observer) {
87 base::AutoLock auto_lock(lock_);
88 private_->RemoveObserver(observer);
91 void GpuDataManagerImpl::UnblockDomainFrom3DAPIs(const GURL& url) {
92 base::AutoLock auto_lock(lock_);
93 private_->UnblockDomainFrom3DAPIs(url);
96 void GpuDataManagerImpl::DisableGpuWatchdog() {
97 base::AutoLock auto_lock(lock_);
98 private_->DisableGpuWatchdog();
101 void GpuDataManagerImpl::SetGLStrings(const std::string& gl_vendor,
102 const std::string& gl_renderer,
103 const std::string& gl_version) {
104 base::AutoLock auto_lock(lock_);
105 private_->SetGLStrings(gl_vendor, gl_renderer, gl_version);
108 void GpuDataManagerImpl::GetGLStrings(std::string* gl_vendor,
109 std::string* gl_renderer,
110 std::string* gl_version) {
111 base::AutoLock auto_lock(lock_);
112 private_->GetGLStrings(gl_vendor, gl_renderer, gl_version);
115 void GpuDataManagerImpl::DisableHardwareAcceleration() {
116 base::AutoLock auto_lock(lock_);
117 private_->DisableHardwareAcceleration();
120 bool GpuDataManagerImpl::CanUseGpuBrowserCompositor() const {
121 base::AutoLock auto_lock(lock_);
122 return private_->CanUseGpuBrowserCompositor();
125 void GpuDataManagerImpl::Initialize() {
126 base::AutoLock auto_lock(lock_);
127 private_->Initialize();
130 void GpuDataManagerImpl::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) {
131 base::AutoLock auto_lock(lock_);
132 private_->UpdateGpuInfo(gpu_info);
135 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats(
136 const GPUVideoMemoryUsageStats& video_memory_usage_stats) {
137 base::AutoLock auto_lock(lock_);
138 private_->UpdateVideoMemoryUsageStats(video_memory_usage_stats);
141 void GpuDataManagerImpl::AppendRendererCommandLine(
142 base::CommandLine* command_line) const {
143 base::AutoLock auto_lock(lock_);
144 private_->AppendRendererCommandLine(command_line);
147 void GpuDataManagerImpl::AppendGpuCommandLine(
148 base::CommandLine* command_line) const {
149 base::AutoLock auto_lock(lock_);
150 private_->AppendGpuCommandLine(command_line);
153 void GpuDataManagerImpl::AppendPluginCommandLine(
154 base::CommandLine* command_line) const {
155 base::AutoLock auto_lock(lock_);
156 private_->AppendPluginCommandLine(command_line);
159 void GpuDataManagerImpl::UpdateRendererWebPrefs(
160 WebPreferences* prefs) const {
161 base::AutoLock auto_lock(lock_);
162 private_->UpdateRendererWebPrefs(prefs);
165 std::string GpuDataManagerImpl::GetBlacklistVersion() const {
166 base::AutoLock auto_lock(lock_);
167 return private_->GetBlacklistVersion();
170 std::string GpuDataManagerImpl::GetDriverBugListVersion() const {
171 base::AutoLock auto_lock(lock_);
172 return private_->GetDriverBugListVersion();
175 void GpuDataManagerImpl::GetBlacklistReasons(base::ListValue* reasons) const {
176 base::AutoLock auto_lock(lock_);
177 private_->GetBlacklistReasons(reasons);
180 void GpuDataManagerImpl::GetDriverBugWorkarounds(
181 base::ListValue* workarounds) const {
182 base::AutoLock auto_lock(lock_);
183 private_->GetDriverBugWorkarounds(workarounds);
186 void GpuDataManagerImpl::AddLogMessage(int level,
187 const std::string& header,
188 const std::string& message) {
189 base::AutoLock auto_lock(lock_);
190 private_->AddLogMessage(level, header, message);
193 void GpuDataManagerImpl::ProcessCrashed(
194 base::TerminationStatus exit_code) {
195 base::AutoLock auto_lock(lock_);
196 private_->ProcessCrashed(exit_code);
199 base::ListValue* GpuDataManagerImpl::GetLogMessages() const {
200 base::AutoLock auto_lock(lock_);
201 return private_->GetLogMessages();
204 void GpuDataManagerImpl::HandleGpuSwitch() {
205 base::AutoLock auto_lock(lock_);
206 private_->HandleGpuSwitch();
209 void GpuDataManagerImpl::BlockDomainFrom3DAPIs(
210 const GURL& url, DomainGuilt guilt) {
211 base::AutoLock auto_lock(lock_);
212 private_->BlockDomainFrom3DAPIs(url, guilt);
215 bool GpuDataManagerImpl::Are3DAPIsBlocked(const GURL& url,
216 int render_process_id,
217 int render_view_id,
218 ThreeDAPIType requester) {
219 base::AutoLock auto_lock(lock_);
220 return private_->Are3DAPIsBlocked(
221 url, render_process_id, render_view_id, requester);
224 void GpuDataManagerImpl::DisableDomainBlockingFor3DAPIsForTesting() {
225 base::AutoLock auto_lock(lock_);
226 private_->DisableDomainBlockingFor3DAPIsForTesting();
229 size_t GpuDataManagerImpl::GetBlacklistedFeatureCount() const {
230 base::AutoLock auto_lock(lock_);
231 return private_->GetBlacklistedFeatureCount();
234 void GpuDataManagerImpl::SetDisplayCount(unsigned int display_count) {
235 base::AutoLock auto_lock(lock_);
236 private_->SetDisplayCount(display_count);
239 unsigned int GpuDataManagerImpl::GetDisplayCount() const {
240 base::AutoLock auto_lock(lock_);
241 return private_->GetDisplayCount();
244 bool GpuDataManagerImpl::UpdateActiveGpu(uint32 vendor_id, uint32 device_id) {
245 base::AutoLock auto_lock(lock_);
246 return private_->UpdateActiveGpu(vendor_id, device_id);
249 void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& url,
250 int render_process_id,
251 int render_view_id,
252 ThreeDAPIType requester) {
253 base::AutoLock auto_lock(lock_);
254 private_->Notify3DAPIBlocked(
255 url, render_process_id, render_view_id, requester);
258 void GpuDataManagerImpl::OnGpuProcessInitFailure() {
259 base::AutoLock auto_lock(lock_);
260 private_->OnGpuProcessInitFailure();
263 GpuDataManagerImpl::GpuDataManagerImpl()
264 : private_(GpuDataManagerImplPrivate::Create(this)) {
267 GpuDataManagerImpl::~GpuDataManagerImpl() {
270 } // namespace content