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 "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" |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 // Notify observers in the browser process. | 925 // Notify observers in the browser process. |
926 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); | 926 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); |
927 // Pass the notification to the GPU process to notify observers there. | 927 // Pass the notification to the GPU process to notify observers there. |
928 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 928 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
929 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, | 929 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, |
930 new GpuMsg_GpuSwitched); | 930 new GpuMsg_GpuSwitched); |
931 } | 931 } |
932 | 932 |
933 bool GpuDataManagerImplPrivate::UpdateActiveGpu(uint32_t vendor_id, | 933 bool GpuDataManagerImplPrivate::UpdateActiveGpu(uint32_t vendor_id, |
934 uint32_t device_id) { | 934 uint32_t device_id) { |
| 935 const base::CommandLine* command_line = |
| 936 base::CommandLine::ForCurrentProcess(); |
| 937 |
| 938 // For tests, only the gpu process is allowed to detect the active gpu device |
| 939 // using information on the actual loaded GL driver. |
| 940 if (command_line->HasSwitch(switches::kGpuTestingVendorId) && |
| 941 command_line->HasSwitch(switches::kGpuTestingDeviceId)) { |
| 942 return false; |
| 943 } |
| 944 |
935 if (gpu_info_.gpu.vendor_id == vendor_id && | 945 if (gpu_info_.gpu.vendor_id == vendor_id && |
936 gpu_info_.gpu.device_id == device_id) { | 946 gpu_info_.gpu.device_id == device_id) { |
937 // The primary GPU is active. | 947 // The primary GPU is active. |
938 if (gpu_info_.gpu.active) | 948 if (gpu_info_.gpu.active) |
939 return false; | 949 return false; |
940 gpu_info_.gpu.active = true; | 950 gpu_info_.gpu.active = true; |
941 for (size_t ii = 0; ii < gpu_info_.secondary_gpus.size(); ++ii) | 951 for (size_t ii = 0; ii < gpu_info_.secondary_gpus.size(); ++ii) |
942 gpu_info_.secondary_gpus[ii].active = false; | 952 gpu_info_.secondary_gpus[ii].active = false; |
943 } else { | 953 } else { |
944 // A secondary GPU is active. | 954 // A secondary GPU is active. |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1281 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1272 #if defined(OS_WIN) | 1282 #if defined(OS_WIN) |
1273 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1283 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1274 #endif | 1284 #endif |
1275 complete_gpu_info_already_requested_ = true; | 1285 complete_gpu_info_already_requested_ = true; |
1276 // Some observers might be waiting. | 1286 // Some observers might be waiting. |
1277 NotifyGpuInfoUpdate(); | 1287 NotifyGpuInfoUpdate(); |
1278 } | 1288 } |
1279 | 1289 |
1280 } // namespace content | 1290 } // namespace content |
OLD | NEW |