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

Side by Side Diff: chrome/common/child_process_logging_win.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_posix.cc ('k') | chrome/common/chrome_content_client.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 <windows.h> 7 #include <windows.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/common/chrome_constants.h" 13 #include "chrome/common/chrome_constants.h"
15 #include "chrome/common/crash_keys.h" 14 #include "chrome/common/crash_keys.h"
16 #include "chrome/common/metrics/variations/variations_util.h" 15 #include "chrome/common/metrics/variations/variations_util.h"
17 #include "chrome/installer/util/google_update_settings.h" 16 #include "chrome/installer/util/google_update_settings.h"
18 #include "gpu/config/gpu_info.h"
19 17
20 namespace child_process_logging { 18 namespace child_process_logging {
21 19
22 namespace { 20 namespace {
23 21
24 // exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetClientId. 22 // exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetClientId.
25 typedef void (__cdecl *MainSetClientId)(const wchar_t*); 23 typedef void (__cdecl *MainSetClientId)(const wchar_t*);
26 24
27 // exported in breakpad_win.cc: 25 // exported in breakpad_win.cc:
28 // void __declspec(dllexport) __cdecl SetNumberOfExtensions. 26 // void __declspec(dllexport) __cdecl SetNumberOfExtensions.
29 typedef void (__cdecl *MainSetNumberOfExtensions)(int); 27 typedef void (__cdecl *MainSetNumberOfExtensions)(int);
30 28
31 // exported in breakpad_win.cc: 29 // exported in breakpad_win.cc:
32 // void __declspec(dllexport) __cdecl SetExtensionID. 30 // void __declspec(dllexport) __cdecl SetExtensionID.
33 typedef void (__cdecl *MainSetExtensionID)(size_t, const wchar_t*); 31 typedef void (__cdecl *MainSetExtensionID)(size_t, const wchar_t*);
34 32
35 // exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetGpuInfo.
36 typedef void (__cdecl *MainSetGpuInfo)(const wchar_t*, const wchar_t*,
37 const wchar_t*, const wchar_t*,
38 const wchar_t*);
39
40 // exported in breakpad_win.cc: 33 // exported in breakpad_win.cc:
41 // void __declspec(dllexport) __cdecl SetPrinterInfo. 34 // void __declspec(dllexport) __cdecl SetPrinterInfo.
42 typedef void (__cdecl *MainSetPrinterInfo)(const wchar_t*); 35 typedef void (__cdecl *MainSetPrinterInfo)(const wchar_t*);
43 36
44 // exported in breakpad_win.cc: 37 // exported in breakpad_win.cc:
45 // void __declspec(dllexport) __cdecl SetNumberOfViews. 38 // void __declspec(dllexport) __cdecl SetNumberOfViews.
46 typedef void (__cdecl *MainSetNumberOfViews)(int); 39 typedef void (__cdecl *MainSetNumberOfViews)(int);
47 40
48 // exported in breakpad_win.cc: 41 // exported in breakpad_win.cc:
49 // void __declspec(dllexport) __cdecl SetCommandLine2 42 // void __declspec(dllexport) __cdecl SetCommandLine2
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 for (size_t i = 0; i < kMaxReportedActiveExtensions; ++i) { 133 for (size_t i = 0; i < kMaxReportedActiveExtensions; ++i) {
141 if (iter != extension_ids.end()) { 134 if (iter != extension_ids.end()) {
142 (set_extension_id)(i, ASCIIToWide(iter->c_str()).c_str()); 135 (set_extension_id)(i, ASCIIToWide(iter->c_str()).c_str());
143 ++iter; 136 ++iter;
144 } else { 137 } else {
145 (set_extension_id)(i, L""); 138 (set_extension_id)(i, L"");
146 } 139 }
147 } 140 }
148 } 141 }
149 142
150 void SetGpuInfo(const gpu::GPUInfo& gpu_info) {
151 static MainSetGpuInfo set_gpu_info = NULL;
152 // note: benign race condition on set_gpu_info.
153 if (!set_gpu_info) {
154 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
155 if (!exe_module)
156 return;
157 set_gpu_info = reinterpret_cast<MainSetGpuInfo>(
158 GetProcAddress(exe_module, "SetGpuInfo"));
159 if (!set_gpu_info)
160 return;
161 }
162 (set_gpu_info)(
163 base::StringPrintf(L"0x%04x", gpu_info.gpu.vendor_id).c_str(),
164 base::StringPrintf(L"0x%04x", gpu_info.gpu.device_id).c_str(),
165 UTF8ToUTF16(gpu_info.driver_version).c_str(),
166 UTF8ToUTF16(gpu_info.pixel_shader_version).c_str(),
167 UTF8ToUTF16(gpu_info.vertex_shader_version).c_str());
168 }
169
170 void SetPrinterInfo(const char* printer_info) { 143 void SetPrinterInfo(const char* printer_info) {
171 static MainSetPrinterInfo set_printer_info = NULL; 144 static MainSetPrinterInfo set_printer_info = NULL;
172 // note: benign race condition on set_printer_info. 145 // note: benign race condition on set_printer_info.
173 if (!set_printer_info) { 146 if (!set_printer_info) {
174 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); 147 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
175 if (!exe_module) 148 if (!exe_module)
176 return; 149 return;
177 set_printer_info = reinterpret_cast<MainSetPrinterInfo>( 150 set_printer_info = reinterpret_cast<MainSetPrinterInfo>(
178 GetProcAddress(exe_module, "SetPrinterInfo")); 151 GetProcAddress(exe_module, "SetPrinterInfo"));
179 if (!set_printer_info) 152 if (!set_printer_info)
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 void Init() { 255 void Init() {
283 // Note: on other platforms, this is set up during Breakpad initialization, 256 // Note: on other platforms, this is set up during Breakpad initialization,
284 // in ChromeBreakpadClient. But on Windows, that is before the DLL module is 257 // in ChromeBreakpadClient. But on Windows, that is before the DLL module is
285 // loaded, which is a prerequisite of the crash key system. 258 // loaded, which is a prerequisite of the crash key system.
286 crash_keys::RegisterChromeCrashKeys(); 259 crash_keys::RegisterChromeCrashKeys();
287 base::debug::SetCrashKeyReportingFunctions( 260 base::debug::SetCrashKeyReportingFunctions(
288 &SetCrashKeyValueTrampoline, &ClearCrashKeyValueTrampoline); 261 &SetCrashKeyValueTrampoline, &ClearCrashKeyValueTrampoline);
289 } 262 }
290 263
291 } // namespace child_process_logging 264 } // namespace child_process_logging
OLDNEW
« no previous file with comments | « chrome/common/child_process_logging_posix.cc ('k') | chrome/common/chrome_content_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698