OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/gpu/gpu_data_manager_impl.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 // We have to update GpuFeatureType before notify all the observers. | 109 // We have to update GpuFeatureType before notify all the observers. |
110 NotifyGpuInfoUpdate(); | 110 NotifyGpuInfoUpdate(); |
111 } | 111 } |
112 | 112 |
113 content::GPUInfo GpuDataManagerImpl::GetGPUInfo() const { | 113 content::GPUInfo GpuDataManagerImpl::GetGPUInfo() const { |
114 return gpu_info_; | 114 return gpu_info_; |
115 } | 115 } |
116 | 116 |
| 117 void GpuDataManagerImpl::RequestVidmemUpdate() { |
| 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 119 GpuProcessHost::SendOnIO( |
| 120 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 121 content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, |
| 122 new GpuMsg_GetVidmem()); |
| 123 } |
| 124 |
117 void GpuDataManagerImpl::AddLogMessage(Value* msg) { | 125 void GpuDataManagerImpl::AddLogMessage(Value* msg) { |
118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
119 log_messages_.Append(msg); | 127 log_messages_.Append(msg); |
120 } | 128 } |
121 | 129 |
122 GpuFeatureType GpuDataManagerImpl::GetGpuFeatureType() { | 130 GpuFeatureType GpuDataManagerImpl::GetGpuFeatureType() { |
123 if (software_rendering_) { | 131 if (software_rendering_) { |
124 GpuFeatureType flags; | 132 GpuFeatureType flags; |
125 | 133 |
126 // Skia's software rendering is probably more efficient than going through | 134 // Skia's software rendering is probably more efficient than going through |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 void GpuDataManagerImpl::SetGpuFeatureType(GpuFeatureType feature_type) { | 274 void GpuDataManagerImpl::SetGpuFeatureType(GpuFeatureType feature_type) { |
267 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 275 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
268 UpdateGpuFeatureType(feature_type); | 276 UpdateGpuFeatureType(feature_type); |
269 preliminary_gpu_feature_type_ = gpu_feature_type_; | 277 preliminary_gpu_feature_type_ = gpu_feature_type_; |
270 } | 278 } |
271 | 279 |
272 void GpuDataManagerImpl::NotifyGpuInfoUpdate() { | 280 void GpuDataManagerImpl::NotifyGpuInfoUpdate() { |
273 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); | 281 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); |
274 } | 282 } |
275 | 283 |
| 284 void GpuDataManagerImpl::UpdateVidmem(const content::GPUVidmem& vidmem) { |
| 285 observer_list_->Notify(&GpuDataManagerObserver::OnVidmemUpdate, vidmem); |
| 286 } |
| 287 |
276 void GpuDataManagerImpl::UpdateGpuFeatureType( | 288 void GpuDataManagerImpl::UpdateGpuFeatureType( |
277 GpuFeatureType embedder_feature_type) { | 289 GpuFeatureType embedder_feature_type) { |
278 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 290 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
279 | 291 |
280 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 292 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
281 int flags = embedder_feature_type; | 293 int flags = embedder_feature_type; |
282 | 294 |
283 // Force disable using the GPU for these features, even if they would | 295 // Force disable using the GPU for these features, even if they would |
284 // otherwise be allowed. | 296 // otherwise be allowed. |
285 if (card_blacklisted_ || | 297 if (card_blacklisted_ || |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 335 |
324 void GpuDataManagerImpl::BlacklistCard() { | 336 void GpuDataManagerImpl::BlacklistCard() { |
325 card_blacklisted_ = true; | 337 card_blacklisted_ = true; |
326 | 338 |
327 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; | 339 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; |
328 | 340 |
329 EnableSoftwareRenderingIfNecessary(); | 341 EnableSoftwareRenderingIfNecessary(); |
330 NotifyGpuInfoUpdate(); | 342 NotifyGpuInfoUpdate(); |
331 } | 343 } |
332 | 344 |
OLD | NEW |