OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
11 #include <algorithm> | 11 #include <algorithm> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/base_switches.h" | 14 #include "base/base_switches.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/environment.h" | 16 #include "base/environment.h" |
17 #include "base/file_util.h" | 17 #include "base/file_util.h" |
18 #include "base/file_version_info.h" | 18 #include "base/file_version_info.h" |
19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
20 #include "base/string_split.h" | 20 #include "base/string_split.h" |
21 #include "base/string_util.h" | 21 #include "base/string_util.h" |
| 22 #include "base/stringprintf.h" |
22 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
23 #include "base/win/registry.h" | 24 #include "base/win/registry.h" |
24 #include "base/win/win_util.h" | 25 #include "base/win/win_util.h" |
25 #include "breakpad/src/client/windows/handler/exception_handler.h" | 26 #include "breakpad/src/client/windows/handler/exception_handler.h" |
26 #include "chrome/app/hard_error_handler_win.h" | 27 #include "chrome/app/hard_error_handler_win.h" |
27 #include "chrome/common/child_process_logging.h" | 28 #include "chrome/common/child_process_logging.h" |
28 #include "chrome/common/chrome_result_codes.h" | 29 #include "chrome/common/chrome_result_codes.h" |
29 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/common/env_vars.h" | 31 #include "chrome/common/env_vars.h" |
31 #include "chrome/installer/util/google_chrome_sxs_distribution.h" | 32 #include "chrome/installer/util/google_chrome_sxs_distribution.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 g_custom_entries->push_back( | 135 g_custom_entries->push_back( |
135 google_breakpad::CustomInfoEntry(L"special", special_build.c_str())); | 136 google_breakpad::CustomInfoEntry(L"special", special_build.c_str())); |
136 | 137 |
137 g_num_of_extensions_offset = g_custom_entries->size(); | 138 g_num_of_extensions_offset = g_custom_entries->size(); |
138 g_custom_entries->push_back( | 139 g_custom_entries->push_back( |
139 google_breakpad::CustomInfoEntry(L"num-extensions", L"N/A")); | 140 google_breakpad::CustomInfoEntry(L"num-extensions", L"N/A")); |
140 | 141 |
141 g_extension_ids_offset = g_custom_entries->size(); | 142 g_extension_ids_offset = g_custom_entries->size(); |
142 for (int i = 0; i < kMaxReportedActiveExtensions; ++i) { | 143 for (int i = 0; i < kMaxReportedActiveExtensions; ++i) { |
143 g_custom_entries->push_back(google_breakpad::CustomInfoEntry( | 144 g_custom_entries->push_back(google_breakpad::CustomInfoEntry( |
144 StringPrintf(L"extension-%i", i + 1).c_str(), L"")); | 145 base::StringPrintf(L"extension-%i", i + 1).c_str(), L"")); |
145 } | 146 } |
146 | 147 |
147 // Add empty values for the gpu_info. We'll put the actual values | 148 // Add empty values for the gpu_info. We'll put the actual values |
148 // when we collect them at this location. | 149 // when we collect them at this location. |
149 g_gpu_info_offset = g_custom_entries->size(); | 150 g_gpu_info_offset = g_custom_entries->size(); |
150 g_custom_entries->push_back( | 151 g_custom_entries->push_back( |
151 google_breakpad::CustomInfoEntry(L"gpu-venid", L"")); | 152 google_breakpad::CustomInfoEntry(L"gpu-venid", L"")); |
152 g_custom_entries->push_back( | 153 g_custom_entries->push_back( |
153 google_breakpad::CustomInfoEntry(L"gpu-devid", L"")); | 154 google_breakpad::CustomInfoEntry(L"gpu-devid", L"")); |
154 g_custom_entries->push_back( | 155 g_custom_entries->push_back( |
(...skipping 15 matching lines...) Expand all Loading... |
170 if (type == L"renderer" || type == L"plugin" || type == L"gpu-process") { | 171 if (type == L"renderer" || type == L"plugin" || type == L"gpu-process") { |
171 g_num_of_views_offset = g_custom_entries->size(); | 172 g_num_of_views_offset = g_custom_entries->size(); |
172 g_custom_entries->push_back( | 173 g_custom_entries->push_back( |
173 google_breakpad::CustomInfoEntry(L"num-views", L"")); | 174 google_breakpad::CustomInfoEntry(L"num-views", L"")); |
174 // Create entries for the URL. Currently we only allow each chunk to be 64 | 175 // Create entries for the URL. Currently we only allow each chunk to be 64 |
175 // characters, which isn't enough for a URL. As a hack we create 8 entries | 176 // characters, which isn't enough for a URL. As a hack we create 8 entries |
176 // and split the URL across the g_custom_entries. | 177 // and split the URL across the g_custom_entries. |
177 g_url_chunks_offset = g_custom_entries->size(); | 178 g_url_chunks_offset = g_custom_entries->size(); |
178 for (int i = 0; i < kMaxUrlChunks; ++i) { | 179 for (int i = 0; i < kMaxUrlChunks; ++i) { |
179 g_custom_entries->push_back(google_breakpad::CustomInfoEntry( | 180 g_custom_entries->push_back(google_breakpad::CustomInfoEntry( |
180 StringPrintf(L"url-chunk-%i", i + 1).c_str(), L"")); | 181 base::StringPrintf(L"url-chunk-%i", i + 1).c_str(), L"")); |
181 } | 182 } |
182 } else { | 183 } else { |
183 g_custom_entries->push_back( | 184 g_custom_entries->push_back( |
184 google_breakpad::CustomInfoEntry(L"num-views", L"N/A")); | 185 google_breakpad::CustomInfoEntry(L"num-views", L"N/A")); |
185 | 186 |
186 // Browser-specific g_custom_entries. | 187 // Browser-specific g_custom_entries. |
187 google_breakpad::CustomInfoEntry switch1(L"switch-1", L""); | 188 google_breakpad::CustomInfoEntry switch1(L"switch-1", L""); |
188 google_breakpad::CustomInfoEntry switch2(L"switch-2", L""); | 189 google_breakpad::CustomInfoEntry switch2(L"switch-2", L""); |
189 | 190 |
190 // Get the first two command line switches if they exist. The CommandLine | 191 // Get the first two command line switches if they exist. The CommandLine |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 google_breakpad::CustomInfoEntry::kValueMaxLength, | 336 google_breakpad::CustomInfoEntry::kValueMaxLength, |
336 client_id); | 337 client_id); |
337 } | 338 } |
338 | 339 |
339 static void SetIntegerValue(size_t offset, int value) { | 340 static void SetIntegerValue(size_t offset, int value) { |
340 if (!g_custom_entries) | 341 if (!g_custom_entries) |
341 return; | 342 return; |
342 | 343 |
343 wcscpy_s((*g_custom_entries)[offset].value, | 344 wcscpy_s((*g_custom_entries)[offset].value, |
344 google_breakpad::CustomInfoEntry::kValueMaxLength, | 345 google_breakpad::CustomInfoEntry::kValueMaxLength, |
345 StringPrintf(L"%d", value).c_str()); | 346 base::StringPrintf(L"%d", value).c_str()); |
346 } | 347 } |
347 | 348 |
348 extern "C" void __declspec(dllexport) __cdecl SetNumberOfExtensions( | 349 extern "C" void __declspec(dllexport) __cdecl SetNumberOfExtensions( |
349 int number_of_extensions) { | 350 int number_of_extensions) { |
350 SetIntegerValue(g_num_of_extensions_offset, number_of_extensions); | 351 SetIntegerValue(g_num_of_extensions_offset, number_of_extensions); |
351 } | 352 } |
352 | 353 |
353 extern "C" void __declspec(dllexport) __cdecl SetExtensionID( | 354 extern "C" void __declspec(dllexport) __cdecl SetExtensionID( |
354 int index, const wchar_t* id) { | 355 int index, const wchar_t* id) { |
355 DCHECK(id); | 356 DCHECK(id); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 if (QueueUserWorkItem( | 630 if (QueueUserWorkItem( |
630 &InitCrashReporterThread, | 631 &InitCrashReporterThread, |
631 info, | 632 info, |
632 WT_EXECUTELONGFUNCTION) == 0) { | 633 WT_EXECUTELONGFUNCTION) == 0) { |
633 // We failed to queue to the worker pool, initialize in this thread. | 634 // We failed to queue to the worker pool, initialize in this thread. |
634 InitCrashReporterThread(info); | 635 InitCrashReporterThread(info); |
635 } | 636 } |
636 } | 637 } |
637 } | 638 } |
638 } | 639 } |
OLD | NEW |