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 GpuProcessHost::SendOnIO( |
| 119 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 120 content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, |
| 121 new GpuMsg_GetVidmem()); |
| 122 } |
| 123 |
117 void GpuDataManagerImpl::AddLogMessage(Value* msg) { | 124 void GpuDataManagerImpl::AddLogMessage(Value* msg) { |
118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
119 log_messages_.Append(msg); | 126 log_messages_.Append(msg); |
120 } | 127 } |
121 | 128 |
122 GpuFeatureType GpuDataManagerImpl::GetGpuFeatureType() { | 129 GpuFeatureType GpuDataManagerImpl::GetGpuFeatureType() { |
123 if (software_rendering_) { | 130 if (software_rendering_) { |
124 GpuFeatureType flags; | 131 GpuFeatureType flags; |
125 | 132 |
126 // Skia's software rendering is probably more efficient than going through | 133 // 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) { | 273 void GpuDataManagerImpl::SetGpuFeatureType(GpuFeatureType feature_type) { |
267 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 274 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
268 UpdateGpuFeatureType(feature_type); | 275 UpdateGpuFeatureType(feature_type); |
269 preliminary_gpu_feature_type_ = gpu_feature_type_; | 276 preliminary_gpu_feature_type_ = gpu_feature_type_; |
270 } | 277 } |
271 | 278 |
272 void GpuDataManagerImpl::NotifyGpuInfoUpdate() { | 279 void GpuDataManagerImpl::NotifyGpuInfoUpdate() { |
273 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); | 280 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); |
274 } | 281 } |
275 | 282 |
| 283 void GpuDataManagerImpl::UpdateVidmem(const content::GPUVidmem& vidmem) { |
| 284 observer_list_->Notify(&GpuDataManagerObserver::OnVidmemUpdate, vidmem); |
| 285 } |
| 286 |
276 void GpuDataManagerImpl::UpdateGpuFeatureType( | 287 void GpuDataManagerImpl::UpdateGpuFeatureType( |
277 GpuFeatureType embedder_feature_type) { | 288 GpuFeatureType embedder_feature_type) { |
278 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 289 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
279 | 290 |
280 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 291 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
281 int flags = embedder_feature_type; | 292 int flags = embedder_feature_type; |
282 | 293 |
283 // Force disable using the GPU for these features, even if they would | 294 // Force disable using the GPU for these features, even if they would |
284 // otherwise be allowed. | 295 // otherwise be allowed. |
285 if (card_blacklisted_ || | 296 if (card_blacklisted_ || |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 334 |
324 void GpuDataManagerImpl::BlacklistCard() { | 335 void GpuDataManagerImpl::BlacklistCard() { |
325 card_blacklisted_ = true; | 336 card_blacklisted_ = true; |
326 | 337 |
327 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; | 338 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; |
328 | 339 |
329 EnableSoftwareRenderingIfNecessary(); | 340 EnableSoftwareRenderingIfNecessary(); |
330 NotifyGpuInfoUpdate(); | 341 NotifyGpuInfoUpdate(); |
331 } | 342 } |
332 | 343 |
OLD | NEW |