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

Side by Side Diff: chrome/app/breakpad_win.cc

Issue 9600060: SetPrinterInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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/app/breakpad_linux.cc ('k') | chrome/common/child_process_logging.h » ('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/app/breakpad_win.h" 5 #include "chrome/app/breakpad_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <tchar.h> 9 #include <tchar.h>
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 // A pointer to the custom entries that we send in the event of a crash. We need 68 // A pointer to the custom entries that we send in the event of a crash. We need
69 // this pointer, along with the offsets into it below, so that we can keep the 69 // this pointer, along with the offsets into it below, so that we can keep the
70 // data updated as the state of the browser changes. 70 // data updated as the state of the browser changes.
71 static std::vector<google_breakpad::CustomInfoEntry>* g_custom_entries = NULL; 71 static std::vector<google_breakpad::CustomInfoEntry>* g_custom_entries = NULL;
72 static size_t g_url_chunks_offset; 72 static size_t g_url_chunks_offset;
73 static size_t g_num_of_extensions_offset; 73 static size_t g_num_of_extensions_offset;
74 static size_t g_extension_ids_offset; 74 static size_t g_extension_ids_offset;
75 static size_t g_client_id_offset; 75 static size_t g_client_id_offset;
76 static size_t g_gpu_info_offset; 76 static size_t g_gpu_info_offset;
77 static size_t g_printer_info_offset;
77 static size_t g_num_of_views_offset; 78 static size_t g_num_of_views_offset;
78 static size_t g_num_switches_offset; 79 static size_t g_num_switches_offset;
79 static size_t g_switches_offset; 80 static size_t g_switches_offset;
80 81
81 // Maximum length for plugin path to include in plugin crash reports. 82 // Maximum length for plugin path to include in plugin crash reports.
82 const size_t kMaxPluginPathLength = 256; 83 const size_t kMaxPluginPathLength = 256;
83 84
84 // Dumps the current process memory. 85 // Dumps the current process memory.
85 extern "C" void __declspec(dllexport) __cdecl DumpProcess() { 86 extern "C" void __declspec(dllexport) __cdecl DumpProcess() {
86 if (g_breakpad) 87 if (g_breakpad)
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 g_num_of_extensions_offset = g_custom_entries->size(); 251 g_num_of_extensions_offset = g_custom_entries->size();
251 g_custom_entries->push_back( 252 g_custom_entries->push_back(
252 google_breakpad::CustomInfoEntry(L"num-extensions", L"N/A")); 253 google_breakpad::CustomInfoEntry(L"num-extensions", L"N/A"));
253 254
254 g_extension_ids_offset = g_custom_entries->size(); 255 g_extension_ids_offset = g_custom_entries->size();
255 for (int i = 0; i < kMaxReportedActiveExtensions; ++i) { 256 for (int i = 0; i < kMaxReportedActiveExtensions; ++i) {
256 g_custom_entries->push_back(google_breakpad::CustomInfoEntry( 257 g_custom_entries->push_back(google_breakpad::CustomInfoEntry(
257 base::StringPrintf(L"extension-%i", i + 1).c_str(), L"")); 258 base::StringPrintf(L"extension-%i", i + 1).c_str(), L""));
258 } 259 }
259 260
260 // Add empty values for the gpu_info. We'll put the actual values 261 // Add empty values for the gpu_info. We'll put the actual values when we
261 // when we collect them at this location. 262 // collect them at this location.
262 g_gpu_info_offset = g_custom_entries->size(); 263 g_gpu_info_offset = g_custom_entries->size();
263 g_custom_entries->push_back( 264 static const wchar_t* const kGpuEntries[] = {
264 google_breakpad::CustomInfoEntry(L"gpu-venid", L"")); 265 L"gpu-venid",
265 g_custom_entries->push_back( 266 L"gpu-devid",
266 google_breakpad::CustomInfoEntry(L"gpu-devid", L"")); 267 L"gpu-driver",
267 g_custom_entries->push_back( 268 L"gpu-psver",
268 google_breakpad::CustomInfoEntry(L"gpu-driver", L"")); 269 L"gpu-vsver",
269 g_custom_entries->push_back( 270 };
270 google_breakpad::CustomInfoEntry(L"gpu-psver", L"")); 271 for (size_t i = 0; i < arraysize(kGpuEntries); ++i) {
271 g_custom_entries->push_back( 272 g_custom_entries->push_back(
272 google_breakpad::CustomInfoEntry(L"gpu-vsver", L"")); 273 google_breakpad::CustomInfoEntry(kGpuEntries[i], L""));
274 }
275
276 // Add empty values for the prn_info-*. We'll put the actual values when we
277 // collect them at this location.
278 g_printer_info_offset = g_custom_entries->size();
279 for (size_t i = 0; i < kMaxReportedPrinterRecords; ++i) {
280 g_custom_entries->push_back(
281 google_breakpad::CustomInfoEntry(
282 base::StringPrintf(L"prn-info-%d", i + 1).c_str(), L""));
283 }
273 284
274 // Read the id from registry. If reporting has never been enabled 285 // Read the id from registry. If reporting has never been enabled
275 // the result will be empty string. Its OK since when user enables reporting 286 // the result will be empty string. Its OK since when user enables reporting
276 // we will insert the new value at this location. 287 // we will insert the new value at this location.
277 std::wstring guid; 288 std::wstring guid;
278 GoogleUpdateSettings::GetMetricsId(&guid); 289 GoogleUpdateSettings::GetMetricsId(&guid);
279 g_client_id_offset = g_custom_entries->size(); 290 g_client_id_offset = g_custom_entries->size();
280 g_custom_entries->push_back( 291 g_custom_entries->push_back(
281 google_breakpad::CustomInfoEntry(L"guid", guid.c_str())); 292 google_breakpad::CustomInfoEntry(L"guid", guid.c_str()));
282 293
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 google_breakpad::CustomInfoEntry::kValueMaxLength); 491 google_breakpad::CustomInfoEntry::kValueMaxLength);
481 } 492 }
482 493
483 extern "C" void __declspec(dllexport) __cdecl SetGpuInfo( 494 extern "C" void __declspec(dllexport) __cdecl SetGpuInfo(
484 const wchar_t* vendor_id, const wchar_t* device_id, 495 const wchar_t* vendor_id, const wchar_t* device_id,
485 const wchar_t* driver_version, const wchar_t* pixel_shader_version, 496 const wchar_t* driver_version, const wchar_t* pixel_shader_version,
486 const wchar_t* vertex_shader_version) { 497 const wchar_t* vertex_shader_version) {
487 if (!g_custom_entries) 498 if (!g_custom_entries)
488 return; 499 return;
489 500
490 base::wcslcpy((*g_custom_entries)[g_gpu_info_offset].value, 501 const wchar_t* info[] = {
491 vendor_id, 502 vendor_id,
503 device_id,
504 driver_version,
505 pixel_shader_version,
506 vertex_shader_version
507 };
508
509 for (size_t i = 0; i < arraysize(info); ++i) {
510 base::wcslcpy((*g_custom_entries)[g_gpu_info_offset + i].value,
511 info[i],
512 google_breakpad::CustomInfoEntry::kValueMaxLength);
513 }
514 }
515
516 extern "C" void __declspec(dllexport) __cdecl SetPrinterInfo(
517 const wchar_t* printer_info) {
518 if (!g_custom_entries)
519 return;
520 std::vector<string16> info;
521 base::SplitString(printer_info, L';', &info);
522 DCHECK_LE(info.size(), kMaxReportedPrinterRecords);
523 info.resize(kMaxReportedPrinterRecords);
524 for (size_t i = 0; i < info.size(); ++i) {
525 base::wcslcpy((*g_custom_entries)[g_printer_info_offset + i].value,
526 info[i].c_str(),
492 google_breakpad::CustomInfoEntry::kValueMaxLength); 527 google_breakpad::CustomInfoEntry::kValueMaxLength);
493 base::wcslcpy((*g_custom_entries)[g_gpu_info_offset+1].value, 528 }
494 device_id,
495 google_breakpad::CustomInfoEntry::kValueMaxLength);
496 base::wcslcpy((*g_custom_entries)[g_gpu_info_offset+2].value,
497 driver_version,
498 google_breakpad::CustomInfoEntry::kValueMaxLength);
499 base::wcslcpy((*g_custom_entries)[g_gpu_info_offset+3].value,
500 pixel_shader_version,
501 google_breakpad::CustomInfoEntry::kValueMaxLength);
502 base::wcslcpy((*g_custom_entries)[g_gpu_info_offset+4].value,
503 vertex_shader_version,
504 google_breakpad::CustomInfoEntry::kValueMaxLength);
505 } 529 }
506 530
507 extern "C" void __declspec(dllexport) __cdecl SetNumberOfViews( 531 extern "C" void __declspec(dllexport) __cdecl SetNumberOfViews(
508 int number_of_views) { 532 int number_of_views) {
509 SetIntegerValue(g_num_of_views_offset, number_of_views); 533 SetIntegerValue(g_num_of_views_offset, number_of_views);
510 } 534 }
511 535
512 } // namespace 536 } // namespace
513 537
514 bool WrapMessageBoxWithSEH(const wchar_t* text, const wchar_t* caption, 538 bool WrapMessageBoxWithSEH(const wchar_t* text, const wchar_t* caption,
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 // Tells breakpad to handle breakpoint and single step exceptions. 777 // Tells breakpad to handle breakpoint and single step exceptions.
754 // This might break JIT debuggers, but at least it will always 778 // This might break JIT debuggers, but at least it will always
755 // generate a crashdump for these exceptions. 779 // generate a crashdump for these exceptions.
756 g_breakpad->set_handle_debug_exceptions(true); 780 g_breakpad->set_handle_debug_exceptions(true);
757 } 781 }
758 } 782 }
759 783
760 void InitDefaultCrashCallback(LPTOP_LEVEL_EXCEPTION_FILTER filter) { 784 void InitDefaultCrashCallback(LPTOP_LEVEL_EXCEPTION_FILTER filter) {
761 previous_filter = SetUnhandledExceptionFilter(filter); 785 previous_filter = SetUnhandledExceptionFilter(filter);
762 } 786 }
OLDNEW
« no previous file with comments | « chrome/app/breakpad_linux.cc ('k') | chrome/common/child_process_logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698