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

Side by Side Diff: chrome/common/child_process_logging_mac.mm

Issue 10890015: [Linux] Add field trial tuples to breakpad crash reports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/child_process_logging.h ('k') | chrome/common/child_process_logging_posix.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) 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_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 19 matching lines...) Expand all
30 const char *kUrlChunkFormatStr = "url-chunk-%d"; 30 const char *kUrlChunkFormatStr = "url-chunk-%d";
31 const char *kGuidParamName = "guid"; 31 const char *kGuidParamName = "guid";
32 const char *kGPUVendorIdParamName = "gpu-venid"; 32 const char *kGPUVendorIdParamName = "gpu-venid";
33 const char *kGPUDeviceIdParamName = "gpu-devid"; 33 const char *kGPUDeviceIdParamName = "gpu-devid";
34 const char *kGPUDriverVersionParamName = "gpu-driver"; 34 const char *kGPUDriverVersionParamName = "gpu-driver";
35 const char *kGPUPixelShaderVersionParamName = "gpu-psver"; 35 const char *kGPUPixelShaderVersionParamName = "gpu-psver";
36 const char *kGPUVertexShaderVersionParamName = "gpu-vsver"; 36 const char *kGPUVertexShaderVersionParamName = "gpu-vsver";
37 const char *kGPUGLVersionParamName = "gpu-glver"; 37 const char *kGPUGLVersionParamName = "gpu-glver";
38 const char *kNumberOfViews = "num-views"; 38 const char *kNumberOfViews = "num-views";
39 NSString* const kNumExtensionsName = @"num-extensions"; 39 NSString* const kNumExtensionsName = @"num-extensions";
40 NSString* const kExtensionNameFormat = @"extension-%d"; 40 NSString* const kExtensionNameFormat = @"extension-%zu";
41 NSString* const kPrinterInfoNameFormat = @"prn-info-%zu"; 41 NSString* const kPrinterInfoNameFormat = @"prn-info-%zu";
42 42
43 // Account for the terminating null character. 43 // Account for the terminating null character.
44 static const size_t kClientIdSize = 32 + 1; 44 static const size_t kClientIdSize = 32 + 1;
45 static char g_client_id[kClientIdSize]; 45 static char g_client_id[kClientIdSize];
46 46
47 void SetActiveURLImpl(const GURL& url, 47 void SetActiveURLImpl(const GURL& url,
48 SetCrashKeyValueFuncPtr set_key_func, 48 SetCrashKeyValueFuncPtr set_key_func,
49 ClearCrashKeyValueFuncPtr clear_key_func) { 49 ClearCrashKeyValueFuncPtr clear_key_func) {
50 50
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 void SetActiveExtensions(const std::set<std::string>& extension_ids) { 116 void SetActiveExtensions(const std::set<std::string>& extension_ids) {
117 // Log the count separately to track heavy users. 117 // Log the count separately to track heavy users.
118 const int count = static_cast<int>(extension_ids.size()); 118 const int count = static_cast<int>(extension_ids.size());
119 SetCrashKeyValue(kNumExtensionsName, 119 SetCrashKeyValue(kNumExtensionsName,
120 [NSString stringWithFormat:@"%i", count]); 120 [NSString stringWithFormat:@"%i", count]);
121 121
122 // Record up to |kMaxReportedActiveExtensions| extensions, clearing 122 // Record up to |kMaxReportedActiveExtensions| extensions, clearing
123 // keys if there aren't that many. 123 // keys if there aren't that many.
124 std::set<std::string>::const_iterator iter = extension_ids.begin(); 124 std::set<std::string>::const_iterator iter = extension_ids.begin();
125 for (int i = 0; i < kMaxReportedActiveExtensions; ++i) { 125 for (size_t i = 0; i < kMaxReportedActiveExtensions; ++i) {
126 NSString* key = [NSString stringWithFormat:kExtensionNameFormat, i]; 126 NSString* key = [NSString stringWithFormat:kExtensionNameFormat, i];
127 if (iter != extension_ids.end()) { 127 if (iter != extension_ids.end()) {
128 SetCrashKeyValue(key, [NSString stringWithUTF8String:iter->c_str()]); 128 SetCrashKeyValue(key, [NSString stringWithUTF8String:iter->c_str()]);
129 ++iter; 129 ++iter;
130 } else { 130 } else {
131 ClearCrashKey(key); 131 ClearCrashKey(key);
132 } 132 }
133 } 133 }
134 } 134 }
135 135
(...skipping 20 matching lines...) Expand all
156 set_key_func); 156 set_key_func);
157 SetGpuKeyValue(kGPUVertexShaderVersionParamName, 157 SetGpuKeyValue(kGPUVertexShaderVersionParamName,
158 gpu_info.vertex_shader_version, 158 gpu_info.vertex_shader_version,
159 set_key_func); 159 set_key_func);
160 SetGpuKeyValue(kGPUGLVersionParamName, 160 SetGpuKeyValue(kGPUGLVersionParamName,
161 gpu_info.gl_version, 161 gpu_info.gl_version,
162 set_key_func); 162 set_key_func);
163 } 163 }
164 164
165 void SetGpuInfo(const content::GPUInfo& gpu_info) { 165 void SetGpuInfo(const content::GPUInfo& gpu_info) {
166 SetGpuInfoImpl(gpu_info, SetCrashKeyValue); 166 SetGpuInfoImpl(gpu_info, SetCrashKeyValue);
167 } 167 }
168 168
169 void SetPrinterInfo(const char* printer_info) { 169 void SetPrinterInfo(const char* printer_info) {
170 std::vector<std::string> info; 170 std::vector<std::string> info;
171 base::SplitString(printer_info, L';', &info); 171 base::SplitString(printer_info, L';', &info);
172 info.resize(kMaxReportedPrinterRecords); 172 info.resize(kMaxReportedPrinterRecords);
173 for (size_t i = 0; i < info.size(); ++i) { 173 for (size_t i = 0; i < info.size(); ++i) {
174 NSString* key = [NSString stringWithFormat:kPrinterInfoNameFormat, i]; 174 NSString* key = [NSString stringWithFormat:kPrinterInfoNameFormat, i];
175 ClearCrashKey(key); 175 ClearCrashKey(key);
176 if (!info[i].empty()) { 176 if (!info[i].empty()) {
177 NSString *value = [NSString stringWithUTF8String:info[i].c_str()]; 177 NSString *value = [NSString stringWithUTF8String:info[i].c_str()];
178 SetCrashKeyValue(key, value); 178 SetCrashKeyValue(key, value);
179 } 179 }
180 } 180 }
181 } 181 }
182 182
183 void SetNumberOfViewsImpl(int number_of_views, 183 void SetNumberOfViewsImpl(int number_of_views,
184 SetCrashKeyValueFuncPtr set_key_func) { 184 SetCrashKeyValueFuncPtr set_key_func) {
185 NSString *key = [NSString stringWithUTF8String:kNumberOfViews]; 185 NSString *key = [NSString stringWithUTF8String:kNumberOfViews];
186 NSString *value = [NSString stringWithFormat:@"%d", number_of_views]; 186 NSString *value = [NSString stringWithFormat:@"%d", number_of_views];
187 set_key_func(key, value); 187 set_key_func(key, value);
188 } 188 }
189 189
190 void SetNumberOfViews(int number_of_views) { 190 void SetNumberOfViews(int number_of_views) {
191 SetNumberOfViewsImpl(number_of_views, SetCrashKeyValue); 191 SetNumberOfViewsImpl(number_of_views, SetCrashKeyValue);
192 } 192 }
193 193
194 void SetCommandLine(const CommandLine* command_line) { 194 void SetCommandLine(const CommandLine* command_line) {
195 DCHECK(command_line); 195 DCHECK(command_line);
196 if (!command_line) 196 if (!command_line)
197 return; 197 return;
198 198
199 // These should match the corresponding strings in breakpad_win.cc. 199 // These should match the corresponding strings in breakpad_win.cc.
200 NSString* const kNumSwitchesKey = @"num-switches"; 200 NSString* const kNumSwitchesKey = @"num-switches";
201 NSString* const kSwitchKeyFormat = @"switch-%zu"; // 1-based. 201 NSString* const kSwitchKeyFormat = @"switch-%zu"; // 1-based.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 249 }
250 250
251 void SetChannel(const std::string& channel) { 251 void SetChannel(const std::string& channel) {
252 // This should match the corresponding string in breakpad_win.cc. 252 // This should match the corresponding string in breakpad_win.cc.
253 NSString* const kChannelKey = @"channel"; 253 NSString* const kChannelKey = @"channel";
254 254
255 SetCrashKeyValue(kChannelKey, base::SysUTF8ToNSString(channel)); 255 SetCrashKeyValue(kChannelKey, base::SysUTF8ToNSString(channel));
256 } 256 }
257 257
258 } // namespace child_process_logging 258 } // namespace child_process_logging
OLDNEW
« no previous file with comments | « chrome/common/child_process_logging.h ('k') | chrome/common/child_process_logging_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698