Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl_private.cc

Issue 2827323002: gpu:: Remove GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate(). (Closed)
Patch Set: comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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_private.h" 5 #include "content/browser/gpu/gpu_data_manager_impl_private.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED, 257 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED,
258 BLOCK_STATUS_ALL_DOMAINS_BLOCKED, 258 BLOCK_STATUS_ALL_DOMAINS_BLOCKED,
259 BLOCK_STATUS_MAX 259 BLOCK_STATUS_MAX
260 }; 260 };
261 261
262 bool ShouldDisableHardwareAcceleration() { 262 bool ShouldDisableHardwareAcceleration() {
263 return base::CommandLine::ForCurrentProcess()->HasSwitch( 263 return base::CommandLine::ForCurrentProcess()->HasSwitch(
264 switches::kDisableGpu); 264 switches::kDisableGpu);
265 } 265 }
266 266
267 void OnVideoMemoryUsageStats(const gpu::VideoMemoryUsageStats& stats) { 267 void RequestVideoMemoryUsageStats(
268 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats(stats); 268 const base::Callback<void(const gpu::VideoMemoryUsageStats& stats)>&
269 } 269 callback,
270 270 GpuProcessHost* host) {
271 void RequestVideoMemoryUsageStats(GpuProcessHost* host) {
272 if (!host) 271 if (!host)
273 return; 272 return;
274 host->gpu_service()->GetVideoMemoryUsageStats( 273 host->gpu_service()->GetVideoMemoryUsageStats(callback);
275 base::Bind(&OnVideoMemoryUsageStats));
276 } 274 }
277 275
278 void UpdateGpuInfoOnIO(const gpu::GPUInfo& gpu_info) { 276 void UpdateGpuInfoOnIO(const gpu::GPUInfo& gpu_info) {
279 // This function is called on the IO thread, but GPUInfo on GpuDataManagerImpl 277 // This function is called on the IO thread, but GPUInfo on GpuDataManagerImpl
280 // should be updated on the UI thread (since it can call into functions that 278 // should be updated on the UI thread (since it can call into functions that
281 // expect to run in the UI thread, e.g. ContentClient::SetGpuInfo()). 279 // expect to run in the UI thread, e.g. ContentClient::SetGpuInfo()).
282 BrowserThread::PostTask( 280 BrowserThread::PostTask(
283 BrowserThread::UI, FROM_HERE, 281 BrowserThread::UI, FROM_HERE,
284 base::Bind( 282 base::Bind(
285 [](const gpu::GPUInfo& gpu_info) { 283 [](const gpu::GPUInfo& gpu_info) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } 441 }
444 442
445 bool GpuDataManagerImplPrivate::IsCompleteGpuInfoAvailable() const { 443 bool GpuDataManagerImplPrivate::IsCompleteGpuInfoAvailable() const {
446 #if defined(OS_WIN) 444 #if defined(OS_WIN)
447 if (gpu_info_.dx_diagnostics_info_state == gpu::kCollectInfoNone) 445 if (gpu_info_.dx_diagnostics_info_state == gpu::kCollectInfoNone)
448 return false; 446 return false;
449 #endif 447 #endif
450 return IsEssentialGpuInfoAvailable(); 448 return IsEssentialGpuInfoAvailable();
451 } 449 }
452 450
453 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const { 451 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate(
452 const base::Callback<void(const gpu::VideoMemoryUsageStats& stats)>&
453 callback) const {
454 GpuProcessHost::CallOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, 454 GpuProcessHost::CallOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
455 false /* force_create */, 455 false /* force_create */,
456 base::Bind(&RequestVideoMemoryUsageStats)); 456 base::Bind(&RequestVideoMemoryUsageStats, callback));
457 } 457 }
458 458
459 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const { 459 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const {
460 return use_swiftshader_; 460 return use_swiftshader_;
461 } 461 }
462 462
463 void GpuDataManagerImplPrivate::AddObserver(GpuDataManagerObserver* observer) { 463 void GpuDataManagerImplPrivate::AddObserver(GpuDataManagerObserver* observer) {
464 GpuDataManagerImpl::UnlockedSession session(owner_); 464 GpuDataManagerImpl::UnlockedSession session(owner_);
465 observer_list_->AddObserver(observer); 465 observer_list_->AddObserver(observer);
466 } 466 }
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 UpdateGpuInfoHelper(); 706 UpdateGpuInfoHelper();
707 } 707 }
708 708
709 void GpuDataManagerImplPrivate::UpdateGpuFeatureInfo( 709 void GpuDataManagerImplPrivate::UpdateGpuFeatureInfo(
710 const gpu::GpuFeatureInfo& gpu_feature_info) { 710 const gpu::GpuFeatureInfo& gpu_feature_info) {
711 if (!use_swiftshader_) { 711 if (!use_swiftshader_) {
712 gpu_feature_info_ = gpu_feature_info; 712 gpu_feature_info_ = gpu_feature_info;
713 } 713 }
714 } 714 }
715 715
716 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats(
717 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) {
718 GpuDataManagerImpl::UnlockedSession session(owner_);
719 observer_list_->Notify(FROM_HERE,
720 &GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate,
721 video_memory_usage_stats);
722 }
723
724 void GpuDataManagerImplPrivate::AppendRendererCommandLine( 716 void GpuDataManagerImplPrivate::AppendRendererCommandLine(
725 base::CommandLine* command_line) const { 717 base::CommandLine* command_line) const {
726 DCHECK(command_line); 718 DCHECK(command_line);
727 719
728 if (ShouldDisableAcceleratedVideoDecode(command_line)) 720 if (ShouldDisableAcceleratedVideoDecode(command_line))
729 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); 721 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
730 #if BUILDFLAG(ENABLE_WEBRTC) 722 #if BUILDFLAG(ENABLE_WEBRTC)
731 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && 723 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) &&
732 !command_line->HasSwitch(switches::kDisableWebRtcHWVP8Encoding)) 724 !command_line->HasSwitch(switches::kDisableWebRtcHWVP8Encoding))
733 command_line->AppendSwitch(switches::kDisableWebRtcHWVP8Encoding); 725 command_line->AppendSwitch(switches::kDisableWebRtcHWVP8Encoding);
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; 1399 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure;
1408 #if defined(OS_WIN) 1400 #if defined(OS_WIN)
1409 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; 1401 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure;
1410 #endif 1402 #endif
1411 complete_gpu_info_already_requested_ = true; 1403 complete_gpu_info_already_requested_ = true;
1412 // Some observers might be waiting. 1404 // Some observers might be waiting.
1413 NotifyGpuInfoUpdate(); 1405 NotifyGpuInfoUpdate();
1414 } 1406 }
1415 1407
1416 } // namespace content 1408 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698