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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 // We have to update GpuFeatureType before notify all the observers. | 113 // We have to update GpuFeatureType before notify all the observers. |
114 NotifyGpuInfoUpdate(); | 114 NotifyGpuInfoUpdate(); |
115 } | 115 } |
116 | 116 |
117 content::GPUInfo GpuDataManagerImpl::GetGPUInfo() const { | 117 content::GPUInfo GpuDataManagerImpl::GetGPUInfo() const { |
118 return gpu_info_; | 118 return gpu_info_; |
119 } | 119 } |
120 | 120 |
| 121 void GpuDataManagerImpl::RequestVideoMemoryUsageStatsUpdate() { |
| 122 GpuProcessHost::SendOnIO( |
| 123 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 124 content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, |
| 125 new GpuMsg_GetVideoMemoryUsageStats()); |
| 126 } |
| 127 |
121 void GpuDataManagerImpl::AddLogMessage(Value* msg) { | 128 void GpuDataManagerImpl::AddLogMessage(Value* msg) { |
122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 129 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
123 log_messages_.Append(msg); | 130 log_messages_.Append(msg); |
124 } | 131 } |
125 | 132 |
126 GpuFeatureType GpuDataManagerImpl::GetGpuFeatureType() { | 133 GpuFeatureType GpuDataManagerImpl::GetGpuFeatureType() { |
127 if (software_rendering_) { | 134 if (software_rendering_) { |
128 GpuFeatureType flags; | 135 GpuFeatureType flags; |
129 | 136 |
130 // Skia's software rendering is probably more efficient than going through | 137 // Skia's software rendering is probably more efficient than going through |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 void GpuDataManagerImpl::SetGpuFeatureType(GpuFeatureType feature_type) { | 295 void GpuDataManagerImpl::SetGpuFeatureType(GpuFeatureType feature_type) { |
289 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 296 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
290 UpdateGpuFeatureType(feature_type); | 297 UpdateGpuFeatureType(feature_type); |
291 preliminary_gpu_feature_type_ = gpu_feature_type_; | 298 preliminary_gpu_feature_type_ = gpu_feature_type_; |
292 } | 299 } |
293 | 300 |
294 void GpuDataManagerImpl::NotifyGpuInfoUpdate() { | 301 void GpuDataManagerImpl::NotifyGpuInfoUpdate() { |
295 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); | 302 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); |
296 } | 303 } |
297 | 304 |
| 305 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats( |
| 306 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 307 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, |
| 308 video_memory_usage_stats); |
| 309 } |
| 310 |
298 void GpuDataManagerImpl::UpdateGpuFeatureType( | 311 void GpuDataManagerImpl::UpdateGpuFeatureType( |
299 GpuFeatureType embedder_feature_type) { | 312 GpuFeatureType embedder_feature_type) { |
300 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 313 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
301 | 314 |
302 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 315 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
303 int flags = embedder_feature_type; | 316 int flags = embedder_feature_type; |
304 | 317 |
305 // Force disable using the GPU for these features, even if they would | 318 // Force disable using the GPU for these features, even if they would |
306 // otherwise be allowed. | 319 // otherwise be allowed. |
307 if (card_blacklisted_ || | 320 if (card_blacklisted_ || |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 358 |
346 void GpuDataManagerImpl::BlacklistCard() { | 359 void GpuDataManagerImpl::BlacklistCard() { |
347 card_blacklisted_ = true; | 360 card_blacklisted_ = true; |
348 | 361 |
349 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; | 362 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; |
350 | 363 |
351 EnableSoftwareRenderingIfNecessary(); | 364 EnableSoftwareRenderingIfNecessary(); |
352 NotifyGpuInfoUpdate(); | 365 NotifyGpuInfoUpdate(); |
353 } | 366 } |
354 | 367 |
OLD | NEW |