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

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: '' 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
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" 12 #include "base/strings/stringprintf.h"
Lei Zhang 2013/08/26 21:41:01 remove
Robert Sesek 2013/08/27 15:34:52 Done.
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/common/chrome_constants.h" 14 #include "chrome/common/chrome_constants.h"
15 #include "chrome/common/crash_keys.h" 15 #include "chrome/common/crash_keys.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 "gpu/config/gpu_info.h"
19 18
20 namespace child_process_logging { 19 namespace child_process_logging {
21 20
22 namespace { 21 namespace {
23 22
24 // exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetClientId. 23 // exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetClientId.
25 typedef void (__cdecl *MainSetClientId)(const wchar_t*); 24 typedef void (__cdecl *MainSetClientId)(const wchar_t*);
26 25
27 // exported in breakpad_win.cc: 26 // exported in breakpad_win.cc:
28 // void __declspec(dllexport) __cdecl SetNumberOfExtensions. 27 // void __declspec(dllexport) __cdecl SetNumberOfExtensions.
29 typedef void (__cdecl *MainSetNumberOfExtensions)(int); 28 typedef void (__cdecl *MainSetNumberOfExtensions)(int);
30 29
31 // exported in breakpad_win.cc: 30 // exported in breakpad_win.cc:
32 // void __declspec(dllexport) __cdecl SetExtensionID. 31 // void __declspec(dllexport) __cdecl SetExtensionID.
33 typedef void (__cdecl *MainSetExtensionID)(size_t, const wchar_t*); 32 typedef void (__cdecl *MainSetExtensionID)(size_t, const wchar_t*);
34 33
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: 34 // exported in breakpad_win.cc:
41 // void __declspec(dllexport) __cdecl SetPrinterInfo. 35 // void __declspec(dllexport) __cdecl SetPrinterInfo.
42 typedef void (__cdecl *MainSetPrinterInfo)(const wchar_t*); 36 typedef void (__cdecl *MainSetPrinterInfo)(const wchar_t*);
43 37
44 // exported in breakpad_win.cc: 38 // exported in breakpad_win.cc:
45 // void __declspec(dllexport) __cdecl SetNumberOfViews. 39 // void __declspec(dllexport) __cdecl SetNumberOfViews.
46 typedef void (__cdecl *MainSetNumberOfViews)(int); 40 typedef void (__cdecl *MainSetNumberOfViews)(int);
47 41
48 // exported in breakpad_win.cc: 42 // exported in breakpad_win.cc:
49 // void __declspec(dllexport) __cdecl SetCommandLine2 43 // 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) { 134 for (size_t i = 0; i < kMaxReportedActiveExtensions; ++i) {
141 if (iter != extension_ids.end()) { 135 if (iter != extension_ids.end()) {
142 (set_extension_id)(i, ASCIIToWide(iter->c_str()).c_str()); 136 (set_extension_id)(i, ASCIIToWide(iter->c_str()).c_str());
143 ++iter; 137 ++iter;
144 } else { 138 } else {
145 (set_extension_id)(i, L""); 139 (set_extension_id)(i, L"");
146 } 140 }
147 } 141 }
148 } 142 }
149 143
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) { 144 void SetPrinterInfo(const char* printer_info) {
171 static MainSetPrinterInfo set_printer_info = NULL; 145 static MainSetPrinterInfo set_printer_info = NULL;
172 // note: benign race condition on set_printer_info. 146 // note: benign race condition on set_printer_info.
173 if (!set_printer_info) { 147 if (!set_printer_info) {
174 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); 148 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
175 if (!exe_module) 149 if (!exe_module)
176 return; 150 return;
177 set_printer_info = reinterpret_cast<MainSetPrinterInfo>( 151 set_printer_info = reinterpret_cast<MainSetPrinterInfo>(
178 GetProcAddress(exe_module, "SetPrinterInfo")); 152 GetProcAddress(exe_module, "SetPrinterInfo"));
179 if (!set_printer_info) 153 if (!set_printer_info)
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 void Init() { 256 void Init() {
283 // Note: on other platforms, this is set up during Breakpad initialization, 257 // Note: on other platforms, this is set up during Breakpad initialization,
284 // in ChromeBreakpadClient. But on Windows, that is before the DLL module is 258 // in ChromeBreakpadClient. But on Windows, that is before the DLL module is
285 // loaded, which is a prerequisite of the crash key system. 259 // loaded, which is a prerequisite of the crash key system.
286 crash_keys::RegisterChromeCrashKeys(); 260 crash_keys::RegisterChromeCrashKeys();
287 base::debug::SetCrashKeyReportingFunctions( 261 base::debug::SetCrashKeyReportingFunctions(
288 &SetCrashKeyValueTrampoline, &ClearCrashKeyValueTrampoline); 262 &SetCrashKeyValueTrampoline, &ClearCrashKeyValueTrampoline);
289 } 263 }
290 264
291 } // namespace child_process_logging 265 } // namespace child_process_logging
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698