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

Side by Side Diff: chrome/common/child_process_logging_posix.cc

Issue 23021021: Set the GPU info using the crash key system instead of platform-specific mechanisms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 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_mac.mm ('k') | chrome/common/child_process_logging_win.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 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/common/metrics/variations/variations_util.h" 13 #include "chrome/common/metrics/variations/variations_util.h"
14 #include "chrome/installer/util/google_update_settings.h" 14 #include "chrome/installer/util/google_update_settings.h"
15 #include "gpu/config/gpu_info.h"
16 #include "url/gurl.h"
17 15
18 namespace child_process_logging { 16 namespace child_process_logging {
19 17
20 // Account for the terminating null character. 18 // Account for the terminating null character.
21 static const size_t kClientIdSize = 32 + 1; 19 static const size_t kClientIdSize = 32 + 1;
22 static const size_t kChannelSize = 32; 20 static const size_t kChannelSize = 32;
23 21
24 // We use static strings to hold the most recent active url and the client 22 // We use static strings to hold the most recent active url and the client
25 // identifier. If we crash, the crash handler code will send the contents of 23 // identifier. If we crash, the crash handler code will send the contents of
26 // these strings to the browser. 24 // these strings to the browser.
27 char g_client_id[kClientIdSize]; 25 char g_client_id[kClientIdSize];
28 26
29 char g_channel[kChannelSize] = ""; 27 char g_channel[kChannelSize] = "";
30 28
31 static const size_t kGpuStringSize = 32;
32 char g_gpu_vendor_id[kGpuStringSize] = "";
33 char g_gpu_device_id[kGpuStringSize] = "";
34 char g_gpu_gl_vendor[kGpuStringSize] = "";
35 char g_gpu_gl_renderer[kGpuStringSize] = "";
36 char g_gpu_driver_ver[kGpuStringSize] = "";
37 char g_gpu_ps_ver[kGpuStringSize] = "";
38 char g_gpu_vs_ver[kGpuStringSize] = "";
39
40 char g_printer_info[kPrinterInfoStrLen * kMaxReportedPrinterRecords + 1] = ""; 29 char g_printer_info[kPrinterInfoStrLen * kMaxReportedPrinterRecords + 1] = "";
41 30
42 static const size_t kNumSize = 32; 31 static const size_t kNumSize = 32;
43 char g_num_extensions[kNumSize] = ""; 32 char g_num_extensions[kNumSize] = "";
44 char g_num_switches[kNumSize] = ""; 33 char g_num_switches[kNumSize] = "";
45 char g_num_variations[kNumSize] = ""; 34 char g_num_variations[kNumSize] = "";
46 char g_num_views[kNumSize] = ""; 35 char g_num_views[kNumSize] = "";
47 36
48 static const size_t kMaxExtensionSize = 37 static const size_t kMaxExtensionSize =
49 kExtensionLen * kMaxReportedActiveExtensions + 1; 38 kExtensionLen * kMaxReportedActiveExtensions + 1;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 std::set<std::string>::const_iterator iter = extension_ids.begin(); 70 std::set<std::string>::const_iterator iter = extension_ids.begin();
82 for (size_t i = 0; 71 for (size_t i = 0;
83 i < kMaxReportedActiveExtensions && iter != extension_ids.end(); 72 i < kMaxReportedActiveExtensions && iter != extension_ids.end();
84 ++i, ++iter) { 73 ++i, ++iter) {
85 extension_str += *iter; 74 extension_str += *iter;
86 } 75 }
87 base::strlcpy(g_extension_ids, extension_str.c_str(), 76 base::strlcpy(g_extension_ids, extension_str.c_str(),
88 arraysize(g_extension_ids)); 77 arraysize(g_extension_ids));
89 } 78 }
90 79
91 void SetGpuInfo(const gpu::GPUInfo& gpu_info) {
92 snprintf(g_gpu_vendor_id, arraysize(g_gpu_vendor_id), "0x%04x",
93 gpu_info.gpu.vendor_id);
94 snprintf(g_gpu_device_id, arraysize(g_gpu_device_id), "0x%04x",
95 gpu_info.gpu.device_id);
96 base::strlcpy(g_gpu_gl_vendor, gpu_info.gl_vendor.c_str(),
97 arraysize(g_gpu_gl_vendor));
98 base::strlcpy(g_gpu_gl_renderer, gpu_info.gl_renderer.c_str(),
99 arraysize(g_gpu_gl_renderer));
100 base::strlcpy(g_gpu_driver_ver, gpu_info.driver_version.c_str(),
101 arraysize(g_gpu_driver_ver));
102 base::strlcpy(g_gpu_ps_ver, gpu_info.pixel_shader_version.c_str(),
103 arraysize(g_gpu_ps_ver));
104 base::strlcpy(g_gpu_vs_ver, gpu_info.vertex_shader_version.c_str(),
105 arraysize(g_gpu_vs_ver));
106 }
107
108 void SetPrinterInfo(const char* printer_info) { 80 void SetPrinterInfo(const char* printer_info) {
109 std::string printer_info_str; 81 std::string printer_info_str;
110 std::vector<std::string> info; 82 std::vector<std::string> info;
111 base::SplitString(printer_info, L';', &info); 83 base::SplitString(printer_info, L';', &info);
112 DCHECK_LE(info.size(), kMaxReportedPrinterRecords); 84 DCHECK_LE(info.size(), kMaxReportedPrinterRecords);
113 for (size_t i = 0; i < info.size(); ++i) { 85 for (size_t i = 0; i < info.size(); ++i) {
114 printer_info_str += info[i]; 86 printer_info_str += info[i];
115 // Truncate long switches, align short ones with spaces to be trimmed later. 87 // Truncate long switches, align short ones with spaces to be trimmed later.
116 printer_info_str.resize((i + 1) * kPrinterInfoStrLen, ' '); 88 printer_info_str.resize((i + 1) * kPrinterInfoStrLen, ' ');
117 } 89 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // simultaneously. 134 // simultaneously.
163 snprintf(g_num_variations, arraysize(g_num_variations), "%" PRIuS, 135 snprintf(g_num_variations, arraysize(g_num_variations), "%" PRIuS,
164 experiments.size()); 136 experiments.size());
165 } 137 }
166 138
167 void SetChannel(const std::string& channel) { 139 void SetChannel(const std::string& channel) {
168 base::strlcpy(g_channel, channel.c_str(), arraysize(g_channel)); 140 base::strlcpy(g_channel, channel.c_str(), arraysize(g_channel));
169 } 141 }
170 142
171 } // namespace child_process_logging 143 } // namespace child_process_logging
OLDNEW
« no previous file with comments | « chrome/common/child_process_logging_mac.mm ('k') | chrome/common/child_process_logging_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698