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

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

Issue 23503070: Revert 223610 "Set the printer info in crash reports using the c..." (Closed) Base URL: svn://svn.chromium.org/chrome/
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/app/breakpad_win.h" 5 #include "chrome/app/breakpad_win.h"
6 6
7 #include <shellapi.h> 7 #include <shellapi.h>
8 #include <tchar.h> 8 #include <tchar.h>
9 #include <userenv.h> 9 #include <userenv.h>
10 #include <windows.h> 10 #include <windows.h>
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 EXCEPTION_POINTERS g_surrogate_exception_pointers = {0}; 99 EXCEPTION_POINTERS g_surrogate_exception_pointers = {0};
100 EXCEPTION_RECORD g_surrogate_exception_record = {0}; 100 EXCEPTION_RECORD g_surrogate_exception_record = {0};
101 CONTEXT g_surrogate_context = {0}; 101 CONTEXT g_surrogate_context = {0};
102 102
103 typedef NTSTATUS (WINAPI* NtTerminateProcessPtr)(HANDLE ProcessHandle, 103 typedef NTSTATUS (WINAPI* NtTerminateProcessPtr)(HANDLE ProcessHandle,
104 NTSTATUS ExitStatus); 104 NTSTATUS ExitStatus);
105 char* g_real_terminate_process_stub = NULL; 105 char* g_real_terminate_process_stub = NULL;
106 106
107 static size_t g_client_id_offset = 0; 107 static size_t g_client_id_offset = 0;
108 static size_t g_printer_info_offset = 0;
108 static size_t g_num_switches_offset = 0; 109 static size_t g_num_switches_offset = 0;
109 static size_t g_switches_offset = 0; 110 static size_t g_switches_offset = 0;
110 static size_t g_dynamic_keys_offset = 0; 111 static size_t g_dynamic_keys_offset = 0;
111 typedef std::map<std::wstring, google_breakpad::CustomInfoEntry*> 112 typedef std::map<std::wstring, google_breakpad::CustomInfoEntry*>
112 DynamicEntriesMap; 113 DynamicEntriesMap;
113 DynamicEntriesMap* g_dynamic_entries = NULL; 114 DynamicEntriesMap* g_dynamic_entries = NULL;
114 // Allow for 128 entries. POSIX uses 64 entries of 256 bytes, so Windows needs 115 // Allow for 128 entries. POSIX uses 64 entries of 256 bytes, so Windows needs
115 // 256 entries of 64 bytes to match. See CustomInfoEntry::kValueMaxLength in 116 // 256 entries of 64 bytes to match. See CustomInfoEntry::kValueMaxLength in
116 // Breakpad. 117 // Breakpad.
117 const size_t kMaxDynamicEntries = 256; 118 const size_t kMaxDynamicEntries = 256;
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 L"profile-type", GetProfileType().c_str())); 451 L"profile-type", GetProfileType().c_str()));
451 452
452 if (g_deferred_crash_uploads) 453 if (g_deferred_crash_uploads)
453 g_custom_entries->push_back( 454 g_custom_entries->push_back(
454 google_breakpad::CustomInfoEntry(L"deferred-upload", L"true")); 455 google_breakpad::CustomInfoEntry(L"deferred-upload", L"true"));
455 456
456 if (!special_build.empty()) 457 if (!special_build.empty())
457 g_custom_entries->push_back(google_breakpad::CustomInfoEntry( 458 g_custom_entries->push_back(google_breakpad::CustomInfoEntry(
458 L"special", UTF16ToWide(special_build).c_str())); 459 L"special", UTF16ToWide(special_build).c_str()));
459 460
461 // Add empty values for the prn_info-*. We'll put the actual values when we
462 // collect them at this location.
463 g_printer_info_offset = g_custom_entries->size();
464 // one-based index for the name suffix.
465 for (size_t i = 1; i <= kMaxReportedPrinterRecords; ++i) {
466 g_custom_entries->push_back(
467 google_breakpad::CustomInfoEntry(
468 base::StringPrintf(L"prn-info-%d", i).c_str(), L""));
469 }
470
460 // Read the id from registry. If reporting has never been enabled 471 // Read the id from registry. If reporting has never been enabled
461 // the result will be empty string. Its OK since when user enables reporting 472 // the result will be empty string. Its OK since when user enables reporting
462 // we will insert the new value at this location. 473 // we will insert the new value at this location.
463 std::wstring guid = 474 std::wstring guid =
464 base::UTF16ToWide(breakpad::GetBreakpadClient()->GetCrashGUID()); 475 base::UTF16ToWide(breakpad::GetBreakpadClient()->GetCrashGUID());
465 g_client_id_offset = g_custom_entries->size(); 476 g_client_id_offset = g_custom_entries->size();
466 g_custom_entries->push_back( 477 g_custom_entries->push_back(
467 google_breakpad::CustomInfoEntry(L"guid", guid.c_str())); 478 google_breakpad::CustomInfoEntry(L"guid", guid.c_str()));
468 479
469 // Add empty values for the command line switches. We will fill them with 480 // Add empty values for the command line switches. We will fill them with
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 return; 646 return;
636 647
637 if (!g_custom_entries) 648 if (!g_custom_entries)
638 return; 649 return;
639 650
640 base::wcslcpy((*g_custom_entries)[g_client_id_offset].value, 651 base::wcslcpy((*g_custom_entries)[g_client_id_offset].value,
641 client_id, 652 client_id,
642 google_breakpad::CustomInfoEntry::kValueMaxLength); 653 google_breakpad::CustomInfoEntry::kValueMaxLength);
643 } 654 }
644 655
656 extern "C" void __declspec(dllexport) __cdecl SetPrinterInfo(
657 const wchar_t* printer_info) {
658 if (!g_custom_entries)
659 return;
660 std::vector<string16> info;
661 base::SplitString(printer_info, L';', &info);
662 DCHECK_LE(info.size(), kMaxReportedPrinterRecords);
663 info.resize(kMaxReportedPrinterRecords);
664 for (size_t i = 0; i < info.size(); ++i) {
665 base::wcslcpy((*g_custom_entries)[g_printer_info_offset + i].value,
666 info[i].c_str(),
667 google_breakpad::CustomInfoEntry::kValueMaxLength);
668 }
669 }
670
645 // NOTE: This function is used by SyzyASAN to annotate crash reports. If you 671 // NOTE: This function is used by SyzyASAN to annotate crash reports. If you
646 // change the name or signature of this function you will break SyzyASAN 672 // change the name or signature of this function you will break SyzyASAN
647 // instrumented releases of Chrome. Please contact syzygy-team@chromium.org 673 // instrumented releases of Chrome. Please contact syzygy-team@chromium.org
648 // before doing so! 674 // before doing so!
649 extern "C" void __declspec(dllexport) __cdecl SetCrashKeyValueImpl( 675 extern "C" void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(
650 const wchar_t* key, const wchar_t* value) { 676 const wchar_t* key, const wchar_t* value) {
651 // CustomInfoEntry limits the length of key and value. If they exceed 677 // CustomInfoEntry limits the length of key and value. If they exceed
652 // their maximum length the underlying string handling functions raise 678 // their maximum length the underlying string handling functions raise
653 // an exception and prematurely trigger a crash. Truncate here. 679 // an exception and prematurely trigger a crash. Truncate here.
654 std::wstring safe_key(std::wstring(key).substr( 680 std::wstring safe_key(std::wstring(key).substr(
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 previous_filter = SetUnhandledExceptionFilter(filter); 1032 previous_filter = SetUnhandledExceptionFilter(filter);
1007 } 1033 }
1008 1034
1009 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, 1035 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings,
1010 std::vector<const wchar_t*>* cstrings) { 1036 std::vector<const wchar_t*>* cstrings) {
1011 cstrings->clear(); 1037 cstrings->clear();
1012 cstrings->reserve(wstrings.size()); 1038 cstrings->reserve(wstrings.size());
1013 for (size_t i = 0; i < wstrings.size(); ++i) 1039 for (size_t i = 0; i < wstrings.size(); ++i)
1014 cstrings->push_back(wstrings[i].c_str()); 1040 cstrings->push_back(wstrings[i].c_str());
1015 } 1041 }
OLDNEW
« no previous file with comments | « trunk/src/chrome/app/breakpad_linux.cc ('k') | trunk/src/chrome/browser/printing/print_system_task_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698