| OLD | NEW |
| 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 if (use_swiftshader_) | 330 if (use_swiftshader_) |
| 331 return true; | 331 return true; |
| 332 | 332 |
| 333 if (!gpu_process_accessible_) { | 333 if (!gpu_process_accessible_) { |
| 334 if (reason) { | 334 if (reason) { |
| 335 *reason = "GPU process launch failed."; | 335 *reason = "GPU process launch failed."; |
| 336 } | 336 } |
| 337 return false; | 337 return false; |
| 338 } | 338 } |
| 339 | 339 |
| 340 if (in_process_gpu_) |
| 341 return true; |
| 342 |
| 340 if (card_blacklisted_) { | 343 if (card_blacklisted_) { |
| 341 if (reason) { | 344 if (reason) { |
| 342 *reason = "GPU access is disabled "; | 345 *reason = "GPU access is disabled "; |
| 343 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 346 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 344 if (command_line->HasSwitch(switches::kDisableGpu)) | 347 if (command_line->HasSwitch(switches::kDisableGpu)) |
| 345 *reason += "through commandline switch --disable-gpu."; | 348 *reason += "through commandline switch --disable-gpu."; |
| 346 else | 349 else |
| 347 *reason += "in chrome://settings."; | 350 *reason += "in chrome://settings."; |
| 348 } | 351 } |
| 349 return false; | 352 return false; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 gpu_blacklist_string = gpu::kSoftwareRenderingListJson; | 596 gpu_blacklist_string = gpu::kSoftwareRenderingListJson; |
| 594 } | 597 } |
| 595 if (!force_osmesa && | 598 if (!force_osmesa && |
| 596 !command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { | 599 !command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { |
| 597 gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson; | 600 gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson; |
| 598 } | 601 } |
| 599 InitializeImpl(gpu_blacklist_string, | 602 InitializeImpl(gpu_blacklist_string, |
| 600 gpu_driver_bug_list_string, | 603 gpu_driver_bug_list_string, |
| 601 gpu_info); | 604 gpu_info); |
| 602 | 605 |
| 603 if (command_line->HasSwitch(switches::kSingleProcess) || | 606 if (in_process_gpu_) { |
| 604 command_line->HasSwitch(switches::kInProcessGPU)) { | |
| 605 command_line->AppendSwitch(switches::kDisableGpuWatchdog); | 607 command_line->AppendSwitch(switches::kDisableGpuWatchdog); |
| 606 AppendGpuCommandLine(command_line, nullptr); | 608 AppendGpuCommandLine(command_line, nullptr); |
| 607 } | 609 } |
| 608 } | 610 } |
| 609 | 611 |
| 610 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { | 612 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { |
| 611 GetContentClient()->SetGpuInfo(gpu_info_); | 613 GetContentClient()->SetGpuInfo(gpu_info_); |
| 612 | 614 |
| 613 const base::CommandLine* command_line = | 615 const base::CommandLine* command_line = |
| 614 base::CommandLine::ForCurrentProcess(); | 616 base::CommandLine::ForCurrentProcess(); |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 GpuDataManagerImplPrivate::GpuDataManagerImplPrivate(GpuDataManagerImpl* owner) | 1100 GpuDataManagerImplPrivate::GpuDataManagerImplPrivate(GpuDataManagerImpl* owner) |
| 1099 : complete_gpu_info_already_requested_(false), | 1101 : complete_gpu_info_already_requested_(false), |
| 1100 observer_list_(new GpuDataManagerObserverList), | 1102 observer_list_(new GpuDataManagerObserverList), |
| 1101 use_swiftshader_(false), | 1103 use_swiftshader_(false), |
| 1102 card_blacklisted_(false), | 1104 card_blacklisted_(false), |
| 1103 update_histograms_(true), | 1105 update_histograms_(true), |
| 1104 domain_blocking_enabled_(true), | 1106 domain_blocking_enabled_(true), |
| 1105 owner_(owner), | 1107 owner_(owner), |
| 1106 gpu_process_accessible_(true), | 1108 gpu_process_accessible_(true), |
| 1107 is_initialized_(false), | 1109 is_initialized_(false), |
| 1108 finalized_(false) { | 1110 finalized_(false), |
| 1111 in_process_gpu_(false) { |
| 1109 DCHECK(owner_); | 1112 DCHECK(owner_); |
| 1110 const base::CommandLine* command_line = | 1113 const base::CommandLine* command_line = |
| 1111 base::CommandLine::ForCurrentProcess(); | 1114 base::CommandLine::ForCurrentProcess(); |
| 1112 swiftshader_path_ = | 1115 swiftshader_path_ = command_line->GetSwitchValuePath( |
| 1113 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 1116 switches::kSwiftShaderPath); |
| 1114 switches::kSwiftShaderPath); | |
| 1115 if (ShouldDisableHardwareAcceleration()) | 1117 if (ShouldDisableHardwareAcceleration()) |
| 1116 DisableHardwareAcceleration(); | 1118 DisableHardwareAcceleration(); |
| 1117 | 1119 |
| 1120 if (command_line->HasSwitch(switches::kSingleProcess) || |
| 1121 command_line->HasSwitch(switches::kInProcessGPU)) { |
| 1122 in_process_gpu_ = true; |
| 1123 } |
| 1124 |
| 1118 #if defined(OS_MACOSX) | 1125 #if defined(OS_MACOSX) |
| 1119 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); | 1126 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); |
| 1120 #endif // OS_MACOSX | 1127 #endif // OS_MACOSX |
| 1121 | 1128 |
| 1122 // For testing only. | 1129 // For testing only. |
| 1123 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) { | 1130 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) { |
| 1124 domain_blocking_enabled_ = false; | 1131 domain_blocking_enabled_ = false; |
| 1125 } | 1132 } |
| 1126 } | 1133 } |
| 1127 | 1134 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1331 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
| 1325 #if defined(OS_WIN) | 1332 #if defined(OS_WIN) |
| 1326 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1333 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
| 1327 #endif | 1334 #endif |
| 1328 complete_gpu_info_already_requested_ = true; | 1335 complete_gpu_info_already_requested_ = true; |
| 1329 // Some observers might be waiting. | 1336 // Some observers might be waiting. |
| 1330 NotifyGpuInfoUpdate(); | 1337 NotifyGpuInfoUpdate(); |
| 1331 } | 1338 } |
| 1332 | 1339 |
| 1333 } // namespace content | 1340 } // namespace content |
| OLD | NEW |