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

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

Issue 2717233003: gpu: Use mojom API for getting video memory usage. (Closed)
Patch Set: . Created 3 years, 9 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
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED, 263 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED,
264 BLOCK_STATUS_ALL_DOMAINS_BLOCKED, 264 BLOCK_STATUS_ALL_DOMAINS_BLOCKED,
265 BLOCK_STATUS_MAX 265 BLOCK_STATUS_MAX
266 }; 266 };
267 267
268 bool ShouldDisableHardwareAcceleration() { 268 bool ShouldDisableHardwareAcceleration() {
269 return base::CommandLine::ForCurrentProcess()->HasSwitch( 269 return base::CommandLine::ForCurrentProcess()->HasSwitch(
270 switches::kDisableGpu); 270 switches::kDisableGpu);
271 } 271 }
272 272
273 void OnVideoMemoryUsageStats(const gpu::VideoMemoryUsageStats& stats) {
274 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats(stats);
275 }
276
277 void RequestVideoMemoryUsageStats(GpuProcessHost* host) {
278 host->gpu_service()->GetVideoMemoryUsageStats(
279 base::Bind(&OnVideoMemoryUsageStats));
280 }
281
273 } // namespace anonymous 282 } // namespace anonymous
274 283
275 void GpuDataManagerImplPrivate::InitializeForTesting( 284 void GpuDataManagerImplPrivate::InitializeForTesting(
276 const std::string& gpu_blacklist_json, 285 const std::string& gpu_blacklist_json,
277 const gpu::GPUInfo& gpu_info) { 286 const gpu::GPUInfo& gpu_info) {
278 // This function is for testing only, so disable histograms. 287 // This function is for testing only, so disable histograms.
279 update_histograms_ = false; 288 update_histograms_ = false;
280 289
281 // Prevent all further initialization. 290 // Prevent all further initialization.
282 finalized_ = true; 291 finalized_ = true;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 433
425 bool GpuDataManagerImplPrivate::IsCompleteGpuInfoAvailable() const { 434 bool GpuDataManagerImplPrivate::IsCompleteGpuInfoAvailable() const {
426 #if defined(OS_WIN) 435 #if defined(OS_WIN)
427 if (gpu_info_.dx_diagnostics_info_state == gpu::kCollectInfoNone) 436 if (gpu_info_.dx_diagnostics_info_state == gpu::kCollectInfoNone)
428 return false; 437 return false;
429 #endif 438 #endif
430 return IsEssentialGpuInfoAvailable(); 439 return IsEssentialGpuInfoAvailable();
431 } 440 }
432 441
433 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const { 442 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const {
434 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, 443 GpuProcessHost::CallOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
435 false /* force_create */, 444 false /* force_create */,
436 new GpuMsg_GetVideoMemoryUsageStats()); 445 base::Bind(&RequestVideoMemoryUsageStats));
437 } 446 }
438 447
439 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const { 448 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const {
440 return use_swiftshader_; 449 return use_swiftshader_;
441 } 450 }
442 451
443 void GpuDataManagerImplPrivate::RegisterSwiftShaderPath( 452 void GpuDataManagerImplPrivate::RegisterSwiftShaderPath(
444 const base::FilePath& path) { 453 const base::FilePath& path) {
445 swiftshader_path_ = path; 454 swiftshader_path_ = path;
446 EnableSwiftShaderIfNecessary(); 455 EnableSwiftShaderIfNecessary();
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; 1367 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure;
1359 #if defined(OS_WIN) 1368 #if defined(OS_WIN)
1360 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; 1369 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure;
1361 #endif 1370 #endif
1362 complete_gpu_info_already_requested_ = true; 1371 complete_gpu_info_already_requested_ = true;
1363 // Some observers might be waiting. 1372 // Some observers might be waiting.
1364 NotifyGpuInfoUpdate(); 1373 NotifyGpuInfoUpdate();
1365 } 1374 }
1366 1375
1367 } // namespace content 1376 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698