OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/common/child_process_logging.h" | 5 #include "chrome/common/child_process_logging.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/common/metrics/variations/variations_util.h" | 16 #include "chrome/common/metrics/variations/variations_util.h" |
17 #include "chrome/installer/util/google_update_settings.h" | 17 #include "chrome/installer/util/google_update_settings.h" |
18 #include "content/public/common/gpu_info.h" | |
19 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 #include "gpu/config/gpu_info.h" |
20 | 20 |
21 namespace child_process_logging { | 21 namespace child_process_logging { |
22 | 22 |
23 using base::debug::SetCrashKeyValueFuncT; | 23 using base::debug::SetCrashKeyValueFuncT; |
24 using base::debug::ClearCrashKeyValueFuncT; | 24 using base::debug::ClearCrashKeyValueFuncT; |
25 using base::debug::SetCrashKeyValue; | 25 using base::debug::SetCrashKeyValue; |
26 using base::debug::ClearCrashKey; | 26 using base::debug::ClearCrashKey; |
27 | 27 |
28 const size_t kMaxNumCrashURLChunks = 8; | 28 const size_t kMaxNumCrashURLChunks = 8; |
29 const size_t kMaxNumURLChunkValueLength = 255; | 29 const size_t kMaxNumURLChunkValueLength = 255; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 ClearCrashKey(key); | 120 ClearCrashKey(key); |
121 } | 121 } |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 void SetGpuKeyValue(const char* param_name, const std::string& value_str, | 125 void SetGpuKeyValue(const char* param_name, const std::string& value_str, |
126 SetCrashKeyValueFuncT set_key_func) { | 126 SetCrashKeyValueFuncT set_key_func) { |
127 set_key_func(param_name, value_str); | 127 set_key_func(param_name, value_str); |
128 } | 128 } |
129 | 129 |
130 void SetGpuInfoImpl(const content::GPUInfo& gpu_info, | 130 void SetGpuInfoImpl(const gpu::GPUInfo& gpu_info, |
131 SetCrashKeyValueFuncT set_key_func) { | 131 SetCrashKeyValueFuncT set_key_func) { |
132 SetGpuKeyValue(kGPUVendorIdParamName, | 132 SetGpuKeyValue(kGPUVendorIdParamName, |
133 base::StringPrintf("0x%04x", gpu_info.gpu.vendor_id), | 133 base::StringPrintf("0x%04x", gpu_info.gpu.vendor_id), |
134 set_key_func); | 134 set_key_func); |
135 SetGpuKeyValue(kGPUDeviceIdParamName, | 135 SetGpuKeyValue(kGPUDeviceIdParamName, |
136 base::StringPrintf("0x%04x", gpu_info.gpu.device_id), | 136 base::StringPrintf("0x%04x", gpu_info.gpu.device_id), |
137 set_key_func); | 137 set_key_func); |
138 SetGpuKeyValue(kGPUDriverVersionParamName, | 138 SetGpuKeyValue(kGPUDriverVersionParamName, |
139 gpu_info.driver_version, | 139 gpu_info.driver_version, |
140 set_key_func); | 140 set_key_func); |
141 SetGpuKeyValue(kGPUPixelShaderVersionParamName, | 141 SetGpuKeyValue(kGPUPixelShaderVersionParamName, |
142 gpu_info.pixel_shader_version, | 142 gpu_info.pixel_shader_version, |
143 set_key_func); | 143 set_key_func); |
144 SetGpuKeyValue(kGPUVertexShaderVersionParamName, | 144 SetGpuKeyValue(kGPUVertexShaderVersionParamName, |
145 gpu_info.vertex_shader_version, | 145 gpu_info.vertex_shader_version, |
146 set_key_func); | 146 set_key_func); |
147 SetGpuKeyValue(kGPUGLVersionParamName, | 147 SetGpuKeyValue(kGPUGLVersionParamName, |
148 gpu_info.gl_version, | 148 gpu_info.gl_version, |
149 set_key_func); | 149 set_key_func); |
150 } | 150 } |
151 | 151 |
152 void SetGpuInfo(const content::GPUInfo& gpu_info) { | 152 void SetGpuInfo(const gpu::GPUInfo& gpu_info) { |
153 SetGpuInfoImpl(gpu_info, SetCrashKeyValue); | 153 SetGpuInfoImpl(gpu_info, SetCrashKeyValue); |
154 } | 154 } |
155 | 155 |
156 void SetPrinterInfo(const char* printer_info) { | 156 void SetPrinterInfo(const char* printer_info) { |
157 std::vector<std::string> info; | 157 std::vector<std::string> info; |
158 base::SplitString(printer_info, ';', &info); | 158 base::SplitString(printer_info, ';', &info); |
159 info.resize(kMaxReportedPrinterRecords); | 159 info.resize(kMaxReportedPrinterRecords); |
160 for (size_t i = 0; i < info.size(); ++i) { | 160 for (size_t i = 0; i < info.size(); ++i) { |
161 std::string key = base::StringPrintf(kPrinterInfoNameFormat, i); | 161 std::string key = base::StringPrintf(kPrinterInfoNameFormat, i); |
162 if (!info[i].empty()) { | 162 if (!info[i].empty()) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 base::StringPrintf("%zu", experiments.size())); | 232 base::StringPrintf("%zu", experiments.size())); |
233 } | 233 } |
234 | 234 |
235 void SetChannel(const std::string& channel) { | 235 void SetChannel(const std::string& channel) { |
236 // This should match the corresponding string in breakpad_win.cc. | 236 // This should match the corresponding string in breakpad_win.cc. |
237 const std::string kChannelKey = "channel"; | 237 const std::string kChannelKey = "channel"; |
238 SetCrashKeyValue(kChannelKey, channel); | 238 SetCrashKeyValue(kChannelKey, channel); |
239 } | 239 } |
240 | 240 |
241 } // namespace child_process_logging | 241 } // namespace child_process_logging |
OLD | NEW |