| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/devtools/protocol/system_info_handler.h" | 5 #include "content/browser/devtools/protocol/system_info_handler.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" |
| 14 #include "content/browser/gpu/compositor_util.h" | 15 #include "content/browser/gpu/compositor_util.h" |
| 15 #include "content/public/browser/gpu_data_manager.h" | 16 #include "content/public/browser/gpu_data_manager.h" |
| 16 #include "gpu/config/gpu_feature_type.h" | 17 #include "gpu/config/gpu_feature_type.h" |
| 17 #include "gpu/config/gpu_info.h" | 18 #include "gpu/config/gpu_info.h" |
| 18 #include "gpu/config/gpu_switches.h" | 19 #include "gpu/config/gpu_switches.h" |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 namespace protocol { | 22 namespace protocol { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 for (const std::string& s : GetDriverBugWorkarounds()) | 120 for (const std::string& s : GetDriverBugWorkarounds()) |
| 120 driver_bug_workarounds->addItem(s); | 121 driver_bug_workarounds->addItem(s); |
| 121 | 122 |
| 122 std::unique_ptr<GPUInfo> gpu = GPUInfo::Create() | 123 std::unique_ptr<GPUInfo> gpu = GPUInfo::Create() |
| 123 .SetDevices(std::move(devices)) | 124 .SetDevices(std::move(devices)) |
| 124 .SetAuxAttributes(std::move(aux_attributes)) | 125 .SetAuxAttributes(std::move(aux_attributes)) |
| 125 .SetFeatureStatus(std::move(feature_status)) | 126 .SetFeatureStatus(std::move(feature_status)) |
| 126 .SetDriverBugWorkarounds(std::move(driver_bug_workarounds)) | 127 .SetDriverBugWorkarounds(std::move(driver_bug_workarounds)) |
| 127 .Build(); | 128 .Build(); |
| 128 | 129 |
| 130 base::CommandLine* command = base::CommandLine::ForCurrentProcess(); |
| 131 #if defined(OS_WIN) |
| 132 std::string command_string = |
| 133 base::WideToUTF8(command->GetCommandLineString()); |
| 134 #else |
| 135 std::string command_string = command->GetCommandLineString(); |
| 136 #endif |
| 137 |
| 129 callback->sendSuccess(std::move(gpu), gpu_info.machine_model_name, | 138 callback->sendSuccess(std::move(gpu), gpu_info.machine_model_name, |
| 130 gpu_info.machine_model_version); | 139 gpu_info.machine_model_version, command_string); |
| 131 } | 140 } |
| 132 | 141 |
| 133 } // namespace | 142 } // namespace |
| 134 | 143 |
| 135 class SystemInfoHandlerGpuObserver : public content::GpuDataManagerObserver { | 144 class SystemInfoHandlerGpuObserver : public content::GpuDataManagerObserver { |
| 136 public: | 145 public: |
| 137 explicit SystemInfoHandlerGpuObserver( | 146 explicit SystemInfoHandlerGpuObserver( |
| 138 std::unique_ptr<GetInfoCallback> callback) | 147 std::unique_ptr<GetInfoCallback> callback) |
| 139 : callback_(std::move(callback)), | 148 : callback_(std::move(callback)), |
| 140 weak_factory_(this) { | 149 weak_factory_(this) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 } else { | 215 } else { |
| 207 // We will be able to get more information from the GpuDataManager. | 216 // We will be able to get more information from the GpuDataManager. |
| 208 // Register a transient observer with it to call us back when the | 217 // Register a transient observer with it to call us back when the |
| 209 // information is available. | 218 // information is available. |
| 210 new SystemInfoHandlerGpuObserver(std::move(callback)); | 219 new SystemInfoHandlerGpuObserver(std::move(callback)); |
| 211 } | 220 } |
| 212 } | 221 } |
| 213 | 222 |
| 214 } // namespace protocol | 223 } // namespace protocol |
| 215 } // namespace content | 224 } // namespace content |
| OLD | NEW |