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

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

Issue 1730023004: Revert of Decouple browser-specific GPU IPC messages from GPU service IPCs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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.cc » ('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 "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/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/metrics/sparse_histogram.h" 12 #include "base/metrics/sparse_histogram.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_split.h"
15 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
16 #include "base/sys_info.h" 15 #include "base/sys_info.h"
17 #include "base/trace_event/trace_event.h" 16 #include "base/trace_event/trace_event.h"
18 #include "base/version.h" 17 #include "base/version.h"
19 #include "build/build_config.h" 18 #include "build/build_config.h"
20 #include "cc/base/switches.h" 19 #include "cc/base/switches.h"
21 #include "content/browser/gpu/gpu_process_host.h" 20 #include "content/browser/gpu/gpu_process_host.h"
22 #include "content/common/gpu/gpu_host_messages.h" 21 #include "content/common/gpu/gpu_messages.h"
23 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/gpu_data_manager_observer.h" 23 #include "content/public/browser/gpu_data_manager_observer.h"
25 #include "content/public/common/content_client.h" 24 #include "content/public/common/content_client.h"
26 #include "content/public/common/content_constants.h" 25 #include "content/public/common/content_constants.h"
27 #include "content/public/common/content_switches.h" 26 #include "content/public/common/content_switches.h"
28 #include "content/public/common/web_preferences.h" 27 #include "content/public/common/web_preferences.h"
29 #include "gpu/command_buffer/service/gpu_switches.h" 28 #include "gpu/command_buffer/service/gpu_switches.h"
30 #include "gpu/config/gpu_control_list_jsons.h" 29 #include "gpu/config/gpu_control_list_jsons.h"
31 #include "gpu/config/gpu_driver_bug_workaround_type.h" 30 #include "gpu/config/gpu_driver_bug_workaround_type.h"
32 #include "gpu/config/gpu_feature_type.h" 31 #include "gpu/config/gpu_feature_type.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 401
403 bool GpuDataManagerImplPrivate::IsCompleteGpuInfoAvailable() const { 402 bool GpuDataManagerImplPrivate::IsCompleteGpuInfoAvailable() const {
404 #if defined(OS_WIN) 403 #if defined(OS_WIN)
405 if (gpu_info_.dx_diagnostics_info_state == gpu::kCollectInfoNone) 404 if (gpu_info_.dx_diagnostics_info_state == gpu::kCollectInfoNone)
406 return false; 405 return false;
407 #endif 406 #endif
408 return IsEssentialGpuInfoAvailable(); 407 return IsEssentialGpuInfoAvailable();
409 } 408 }
410 409
411 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const { 410 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const {
412 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, 411 GpuProcessHost::SendOnIO(
413 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, 412 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
414 new GpuMsg_GetVideoMemoryUsageStats()); 413 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
414 new GpuMsg_GetVideoMemoryUsageStats());
415 } 415 }
416 416
417 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const { 417 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const {
418 return use_swiftshader_; 418 return use_swiftshader_;
419 } 419 }
420 420
421 void GpuDataManagerImplPrivate::RegisterSwiftShaderPath( 421 void GpuDataManagerImplPrivate::RegisterSwiftShaderPath(
422 const base::FilePath& path) { 422 const base::FilePath& path) {
423 swiftshader_path_ = path; 423 swiftshader_path_ = path;
424 EnableSwiftShaderIfNecessary(); 424 EnableSwiftShaderIfNecessary();
(...skipping 23 matching lines...) Expand all
448 // 448 //
449 // These policies could be refined, but at a certain point the behavior 449 // These policies could be refined, but at a certain point the behavior
450 // will become difficult to explain. 450 // will become difficult to explain.
451 std::string domain = GetDomainFromURL(url); 451 std::string domain = GetDomainFromURL(url);
452 452
453 blocked_domains_.erase(domain); 453 blocked_domains_.erase(domain);
454 timestamps_of_gpu_resets_.clear(); 454 timestamps_of_gpu_resets_.clear();
455 } 455 }
456 456
457 void GpuDataManagerImplPrivate::DisableGpuWatchdog() { 457 void GpuDataManagerImplPrivate::DisableGpuWatchdog() {
458 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, 458 GpuProcessHost::SendOnIO(
459 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, 459 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
460 new GpuMsg_DisableWatchdog); 460 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
461 new GpuMsg_DisableWatchdog);
461 } 462 }
462 463
463 void GpuDataManagerImplPrivate::SetGLStrings(const std::string& gl_vendor, 464 void GpuDataManagerImplPrivate::SetGLStrings(const std::string& gl_vendor,
464 const std::string& gl_renderer, 465 const std::string& gl_renderer,
465 const std::string& gl_version) { 466 const std::string& gl_version) {
466 if (gl_vendor.empty() && gl_renderer.empty() && gl_version.empty()) 467 if (gl_vendor.empty() && gl_renderer.empty() && gl_version.empty())
467 return; 468 return;
468 469
469 if (!is_initialized_) { 470 if (!is_initialized_) {
470 post_init_tasks_.push_back( 471 post_init_tasks_.push_back(
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 value->Append(dict); 886 value->Append(dict);
886 } 887 }
887 return value; 888 return value;
888 } 889 }
889 890
890 void GpuDataManagerImplPrivate::HandleGpuSwitch() { 891 void GpuDataManagerImplPrivate::HandleGpuSwitch() {
891 GpuDataManagerImpl::UnlockedSession session(owner_); 892 GpuDataManagerImpl::UnlockedSession session(owner_);
892 // Notify observers in the browser process. 893 // Notify observers in the browser process.
893 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); 894 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched();
894 // Pass the notification to the GPU process to notify observers there. 895 // Pass the notification to the GPU process to notify observers there.
895 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, 896 GpuProcessHost::SendOnIO(
896 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, 897 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
897 new GpuMsg_GpuSwitched); 898 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
899 new GpuMsg_GpuSwitched);
898 } 900 }
899 901
900 bool GpuDataManagerImplPrivate::UpdateActiveGpu(uint32_t vendor_id, 902 bool GpuDataManagerImplPrivate::UpdateActiveGpu(uint32_t vendor_id,
901 uint32_t device_id) { 903 uint32_t device_id) {
902 if (gpu_info_.gpu.vendor_id == vendor_id && 904 if (gpu_info_.gpu.vendor_id == vendor_id &&
903 gpu_info_.gpu.device_id == device_id) { 905 gpu_info_.gpu.device_id == device_id) {
904 // The primary GPU is active. 906 // The primary GPU is active.
905 if (gpu_info_.gpu.active) 907 if (gpu_info_.gpu.active)
906 return false; 908 return false;
907 gpu_info_.gpu.active = true; 909 gpu_info_.gpu.active = true;
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; 1239 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure;
1238 #if defined(OS_WIN) 1240 #if defined(OS_WIN)
1239 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; 1241 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure;
1240 #endif 1242 #endif
1241 complete_gpu_info_already_requested_ = true; 1243 complete_gpu_info_already_requested_ = true;
1242 // Some observers might be waiting. 1244 // Some observers might be waiting.
1243 NotifyGpuInfoUpdate(); 1245 NotifyGpuInfoUpdate();
1244 } 1246 }
1245 1247
1246 } // namespace content 1248 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698