OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/crash/app/breakpad_win.h" | 5 #include "components/crash/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 #include <userenv.h> | 10 #include <userenv.h> |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "base/strings/string_split.h" | 25 #include "base/strings/string_split.h" |
26 #include "base/strings/string_util.h" | 26 #include "base/strings/string_util.h" |
27 #include "base/strings/stringprintf.h" | 27 #include "base/strings/stringprintf.h" |
28 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
29 #include "base/synchronization/lock.h" | 29 #include "base/synchronization/lock.h" |
30 #include "base/win/metro.h" | 30 #include "base/win/metro.h" |
31 #include "base/win/pe_image.h" | 31 #include "base/win/pe_image.h" |
32 #include "base/win/registry.h" | 32 #include "base/win/registry.h" |
33 #include "base/win/win_util.h" | 33 #include "base/win/win_util.h" |
34 #include "breakpad/src/client/windows/handler/exception_handler.h" | 34 #include "breakpad/src/client/windows/handler/exception_handler.h" |
35 #include "components/crash/app/breakpad_client.h" | |
36 #include "components/crash/app/crash_keys_win.h" | 35 #include "components/crash/app/crash_keys_win.h" |
| 36 #include "components/crash/app/crash_reporter_client.h" |
37 #include "components/crash/app/hard_error_handler_win.h" | 37 #include "components/crash/app/hard_error_handler_win.h" |
38 #include "content/public/common/result_codes.h" | 38 #include "content/public/common/result_codes.h" |
39 #include "sandbox/win/src/nt_internals.h" | 39 #include "sandbox/win/src/nt_internals.h" |
40 #include "sandbox/win/src/sidestep/preamble_patcher.h" | 40 #include "sandbox/win/src/sidestep/preamble_patcher.h" |
41 | 41 |
42 // userenv.dll is required for GetProfileType(). | 42 // userenv.dll is required for GetProfileType(). |
43 #pragma comment(lib, "userenv.lib") | 43 #pragma comment(lib, "userenv.lib") |
44 | 44 |
45 #pragma intrinsic(_AddressOfReturnAddress) | 45 #pragma intrinsic(_AddressOfReturnAddress) |
46 #pragma intrinsic(_ReturnAddress) | 46 #pragma intrinsic(_ReturnAddress) |
47 | 47 |
48 namespace breakpad { | 48 namespace breakpad { |
49 | 49 |
| 50 using crash_reporter::GetCrashReporterClient; |
| 51 |
50 namespace { | 52 namespace { |
51 | 53 |
52 // Minidump with stacks, PEB, TEB, and unloaded module list. | 54 // Minidump with stacks, PEB, TEB, and unloaded module list. |
53 const MINIDUMP_TYPE kSmallDumpType = static_cast<MINIDUMP_TYPE>( | 55 const MINIDUMP_TYPE kSmallDumpType = static_cast<MINIDUMP_TYPE>( |
54 MiniDumpWithProcessThreadData | // Get PEB and TEB. | 56 MiniDumpWithProcessThreadData | // Get PEB and TEB. |
55 MiniDumpWithUnloadedModules); // Get unloaded modules when available. | 57 MiniDumpWithUnloadedModules); // Get unloaded modules when available. |
56 | 58 |
57 // Minidump with all of the above, plus memory referenced from stack. | 59 // Minidump with all of the above, plus memory referenced from stack. |
58 const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>( | 60 const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>( |
59 MiniDumpWithProcessThreadData | // Get PEB and TEB. | 61 MiniDumpWithProcessThreadData | // Get PEB and TEB. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 bool DumpDoneCallback(const wchar_t*, const wchar_t*, void*, | 195 bool DumpDoneCallback(const wchar_t*, const wchar_t*, void*, |
194 EXCEPTION_POINTERS* ex_info, | 196 EXCEPTION_POINTERS* ex_info, |
195 MDRawAssertionInfo*, bool) { | 197 MDRawAssertionInfo*, bool) { |
196 // Check if the exception is one of the kind which would not be solved | 198 // Check if the exception is one of the kind which would not be solved |
197 // by simply restarting chrome. In this case we show a message box with | 199 // by simply restarting chrome. In this case we show a message box with |
198 // and exit silently. Remember that chrome is in a crashed state so we | 200 // and exit silently. Remember that chrome is in a crashed state so we |
199 // can't show our own UI from this process. | 201 // can't show our own UI from this process. |
200 if (HardErrorHandler(ex_info)) | 202 if (HardErrorHandler(ex_info)) |
201 return true; | 203 return true; |
202 | 204 |
203 if (!GetBreakpadClient()->AboutToRestart()) | 205 if (!GetCrashReporterClient()->AboutToRestart()) |
204 return true; | 206 return true; |
205 | 207 |
206 // Now we just start chrome browser with the same command line. | 208 // Now we just start chrome browser with the same command line. |
207 STARTUPINFOW si = {sizeof(si)}; | 209 STARTUPINFOW si = {sizeof(si)}; |
208 PROCESS_INFORMATION pi; | 210 PROCESS_INFORMATION pi; |
209 if (::CreateProcessW(NULL, ::GetCommandLineW(), NULL, NULL, FALSE, | 211 if (::CreateProcessW(NULL, ::GetCommandLineW(), NULL, NULL, FALSE, |
210 CREATE_UNICODE_ENVIRONMENT, NULL, NULL, &si, &pi)) { | 212 CREATE_UNICODE_ENVIRONMENT, NULL, NULL, &si, &pi)) { |
211 ::CloseHandle(pi.hProcess); | 213 ::CloseHandle(pi.hProcess); |
212 ::CloseHandle(pi.hThread); | 214 ::CloseHandle(pi.hThread); |
213 } | 215 } |
214 // After this return we will be terminated. The actual return value is | 216 // After this return we will be terminated. The actual return value is |
215 // not used at all. | 217 // not used at all. |
216 return true; | 218 return true; |
217 } | 219 } |
218 | 220 |
219 // flag to indicate that we are already handling an exception. | 221 // flag to indicate that we are already handling an exception. |
220 volatile LONG handling_exception = 0; | 222 volatile LONG handling_exception = 0; |
221 | 223 |
222 // This callback is used when there is no crash. Note: Unlike the | 224 // This callback is used when there is no crash. Note: Unlike the |
223 // |FilterCallback| below this does not do dupe detection. It is upto the caller | 225 // |FilterCallback| below this does not do dupe detection. It is upto the caller |
224 // to implement it. | 226 // to implement it. |
225 bool FilterCallbackWhenNoCrash( | 227 bool FilterCallbackWhenNoCrash( |
226 void*, EXCEPTION_POINTERS*, MDRawAssertionInfo*) { | 228 void*, EXCEPTION_POINTERS*, MDRawAssertionInfo*) { |
227 GetBreakpadClient()->RecordCrashDumpAttempt(false); | 229 GetCrashReporterClient()->RecordCrashDumpAttempt(false); |
228 return true; | 230 return true; |
229 } | 231 } |
230 | 232 |
231 // This callback is executed when the Chrome process has crashed and *before* | 233 // This callback is executed when the Chrome process has crashed and *before* |
232 // the crash dump is created. To prevent duplicate crash reports we | 234 // the crash dump is created. To prevent duplicate crash reports we |
233 // make every thread calling this method, except the very first one, | 235 // make every thread calling this method, except the very first one, |
234 // go to sleep. | 236 // go to sleep. |
235 bool FilterCallback(void*, EXCEPTION_POINTERS*, MDRawAssertionInfo*) { | 237 bool FilterCallback(void*, EXCEPTION_POINTERS*, MDRawAssertionInfo*) { |
236 // Capture every thread except the first one in the sleep. We don't | 238 // Capture every thread except the first one in the sleep. We don't |
237 // want multiple threads to concurrently report exceptions. | 239 // want multiple threads to concurrently report exceptions. |
238 if (::InterlockedCompareExchange(&handling_exception, 1, 0) == 1) { | 240 if (::InterlockedCompareExchange(&handling_exception, 1, 0) == 1) { |
239 ::Sleep(INFINITE); | 241 ::Sleep(INFINITE); |
240 } | 242 } |
241 GetBreakpadClient()->RecordCrashDumpAttempt(true); | 243 GetCrashReporterClient()->RecordCrashDumpAttempt(true); |
242 return true; | 244 return true; |
243 } | 245 } |
244 | 246 |
245 // Previous unhandled filter. Will be called if not null when we | 247 // Previous unhandled filter. Will be called if not null when we |
246 // intercept a crash. | 248 // intercept a crash. |
247 LPTOP_LEVEL_EXCEPTION_FILTER previous_filter = NULL; | 249 LPTOP_LEVEL_EXCEPTION_FILTER previous_filter = NULL; |
248 | 250 |
249 // Exception filter used when breakpad is not enabled. We just display | 251 // Exception filter used when breakpad is not enabled. We just display |
250 // the "Do you want to restart" message and then we call the previous filter. | 252 // the "Do you want to restart" message and then we call the previous filter. |
251 long WINAPI ChromeExceptionFilter(EXCEPTION_POINTERS* info) { | 253 long WINAPI ChromeExceptionFilter(EXCEPTION_POINTERS* info) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 static bool WrapMessageBoxWithSEH(const wchar_t* text, const wchar_t* caption, | 298 static bool WrapMessageBoxWithSEH(const wchar_t* text, const wchar_t* caption, |
297 UINT flags, bool* exit_now) { | 299 UINT flags, bool* exit_now) { |
298 // We wrap the call to MessageBoxW with a SEH handler because it some | 300 // We wrap the call to MessageBoxW with a SEH handler because it some |
299 // machines with CursorXP, PeaDict or with FontExplorer installed it crashes | 301 // machines with CursorXP, PeaDict or with FontExplorer installed it crashes |
300 // uncontrollably here. Being this a best effort deal we better go away. | 302 // uncontrollably here. Being this a best effort deal we better go away. |
301 __try { | 303 __try { |
302 *exit_now = (IDOK != ::MessageBoxW(NULL, text, caption, flags)); | 304 *exit_now = (IDOK != ::MessageBoxW(NULL, text, caption, flags)); |
303 } __except(EXCEPTION_EXECUTE_HANDLER) { | 305 } __except(EXCEPTION_EXECUTE_HANDLER) { |
304 // Its not safe to continue executing, exit silently here. | 306 // Its not safe to continue executing, exit silently here. |
305 ::TerminateProcess(::GetCurrentProcess(), | 307 ::TerminateProcess(::GetCurrentProcess(), |
306 GetBreakpadClient()->GetResultCodeRespawnFailed()); | 308 GetCrashReporterClient()->GetResultCodeRespawnFailed()); |
307 } | 309 } |
308 | 310 |
309 return true; | 311 return true; |
310 } | 312 } |
311 | 313 |
312 // This function is executed by the child process that DumpDoneCallback() | 314 // This function is executed by the child process that DumpDoneCallback() |
313 // spawned and basically just shows the 'chrome has crashed' dialog if | 315 // spawned and basically just shows the 'chrome has crashed' dialog if |
314 // the CHROME_CRASHED environment variable is present. | 316 // the CHROME_CRASHED environment variable is present. |
315 bool ShowRestartDialogIfCrashed(bool* exit_now) { | 317 bool ShowRestartDialogIfCrashed(bool* exit_now) { |
316 // If we are being launched in metro mode don't try to show the dialog. | 318 // If we are being launched in metro mode don't try to show the dialog. |
317 if (base::win::IsMetroProcess()) | 319 if (base::win::IsMetroProcess()) |
318 return false; | 320 return false; |
319 | 321 |
320 base::string16 message; | 322 base::string16 message; |
321 base::string16 title; | 323 base::string16 title; |
322 bool is_rtl_locale; | 324 bool is_rtl_locale; |
323 if (!GetBreakpadClient()->ShouldShowRestartDialog( | 325 if (!GetCrashReporterClient()->ShouldShowRestartDialog( |
324 &title, &message, &is_rtl_locale)) { | 326 &title, &message, &is_rtl_locale)) { |
325 return false; | 327 return false; |
326 } | 328 } |
327 | 329 |
328 // If the UI layout is right-to-left, we need to pass the appropriate MB_XXX | 330 // If the UI layout is right-to-left, we need to pass the appropriate MB_XXX |
329 // flags so that an RTL message box is displayed. | 331 // flags so that an RTL message box is displayed. |
330 UINT flags = MB_OKCANCEL | MB_ICONWARNING; | 332 UINT flags = MB_OKCANCEL | MB_ICONWARNING; |
331 if (is_rtl_locale) | 333 if (is_rtl_locale) |
332 flags |= MB_RIGHT | MB_RTLREADING; | 334 flags |= MB_RIGHT | MB_RTLREADING; |
333 | 335 |
334 return WrapMessageBoxWithSEH(message.c_str(), title.c_str(), flags, exit_now); | 336 return WrapMessageBoxWithSEH(message.c_str(), title.c_str(), flags, exit_now); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 429 |
428 static void InitPipeNameEnvVar(bool is_per_user_install) { | 430 static void InitPipeNameEnvVar(bool is_per_user_install) { |
429 scoped_ptr<base::Environment> env(base::Environment::Create()); | 431 scoped_ptr<base::Environment> env(base::Environment::Create()); |
430 if (env->HasVar(kPipeNameVar)) { | 432 if (env->HasVar(kPipeNameVar)) { |
431 // The Breakpad pipe name is already configured: nothing to do. | 433 // The Breakpad pipe name is already configured: nothing to do. |
432 return; | 434 return; |
433 } | 435 } |
434 | 436 |
435 // Check whether configuration management controls crash reporting. | 437 // Check whether configuration management controls crash reporting. |
436 bool crash_reporting_enabled = true; | 438 bool crash_reporting_enabled = true; |
437 bool controlled_by_policy = GetBreakpadClient()->ReportingIsEnforcedByPolicy( | 439 bool controlled_by_policy = |
438 &crash_reporting_enabled); | 440 GetCrashReporterClient()->ReportingIsEnforcedByPolicy( |
| 441 &crash_reporting_enabled); |
439 | 442 |
440 const CommandLine& command = *CommandLine::ForCurrentProcess(); | 443 const CommandLine& command = *CommandLine::ForCurrentProcess(); |
441 bool use_crash_service = | 444 bool use_crash_service = !controlled_by_policy && |
442 !controlled_by_policy && (command.HasSwitch(switches::kNoErrorDialogs) || | 445 (command.HasSwitch(switches::kNoErrorDialogs) || |
443 GetBreakpadClient()->IsRunningUnattended()); | 446 GetCrashReporterClient()->IsRunningUnattended()); |
444 | 447 |
445 std::wstring pipe_name; | 448 std::wstring pipe_name; |
446 if (use_crash_service) { | 449 if (use_crash_service) { |
447 // Crash reporting is done by crash_service.exe. | 450 // Crash reporting is done by crash_service.exe. |
448 pipe_name = kChromePipeName; | 451 pipe_name = kChromePipeName; |
449 } else { | 452 } else { |
450 // We want to use the Google Update crash reporting. We need to check if the | 453 // We want to use the Google Update crash reporting. We need to check if the |
451 // user allows it first (in case the administrator didn't already decide | 454 // user allows it first (in case the administrator didn't already decide |
452 // via policy). | 455 // via policy). |
453 if (!controlled_by_policy) | 456 if (!controlled_by_policy) |
454 crash_reporting_enabled = GetBreakpadClient()->GetCollectStatsConsent(); | 457 crash_reporting_enabled = |
| 458 GetCrashReporterClient()->GetCollectStatsConsent(); |
455 | 459 |
456 if (!crash_reporting_enabled) { | 460 if (!crash_reporting_enabled) { |
457 // Crash reporting is disabled, don't set the environment variable. | 461 // Crash reporting is disabled, don't set the environment variable. |
458 return; | 462 return; |
459 } | 463 } |
460 | 464 |
461 // Build the pipe name. It can be either: | 465 // Build the pipe name. It can be either: |
462 // System-wide install: "NamedPipe\GoogleCrashServices\S-1-5-18" | 466 // System-wide install: "NamedPipe\GoogleCrashServices\S-1-5-18" |
463 // Per-user install: "NamedPipe\GoogleCrashServices\<user SID>" | 467 // Per-user install: "NamedPipe\GoogleCrashServices\<user SID>" |
464 std::wstring user_sid; | 468 std::wstring user_sid; |
(...skipping 25 matching lines...) Expand all Loading... |
490 | 494 |
491 std::wstring process_type = base::ASCIIToWide(process_type_switch); | 495 std::wstring process_type = base::ASCIIToWide(process_type_switch); |
492 if (process_type.empty()) | 496 if (process_type.empty()) |
493 process_type = L"browser"; | 497 process_type = L"browser"; |
494 | 498 |
495 wchar_t exe_path[MAX_PATH]; | 499 wchar_t exe_path[MAX_PATH]; |
496 exe_path[0] = 0; | 500 exe_path[0] = 0; |
497 GetModuleFileNameW(NULL, exe_path, MAX_PATH); | 501 GetModuleFileNameW(NULL, exe_path, MAX_PATH); |
498 | 502 |
499 bool is_per_user_install = | 503 bool is_per_user_install = |
500 GetBreakpadClient()->GetIsPerUserInstall(base::FilePath(exe_path)); | 504 GetCrashReporterClient()->GetIsPerUserInstall(base::FilePath(exe_path)); |
501 | 505 |
502 // This is intentionally leaked. | 506 // This is intentionally leaked. |
503 CrashKeysWin* keeper = new CrashKeysWin(); | 507 CrashKeysWin* keeper = new CrashKeysWin(); |
504 | 508 |
505 google_breakpad::CustomClientInfo* custom_info = | 509 google_breakpad::CustomClientInfo* custom_info = |
506 keeper->GetCustomInfo(exe_path, process_type, | 510 keeper->GetCustomInfo(exe_path, process_type, |
507 GetProfileType(), CommandLine::ForCurrentProcess(), | 511 GetProfileType(), CommandLine::ForCurrentProcess(), |
508 GetBreakpadClient()); | 512 GetCrashReporterClient()); |
509 | 513 |
510 google_breakpad::ExceptionHandler::MinidumpCallback callback = NULL; | 514 google_breakpad::ExceptionHandler::MinidumpCallback callback = NULL; |
511 LPTOP_LEVEL_EXCEPTION_FILTER default_filter = NULL; | 515 LPTOP_LEVEL_EXCEPTION_FILTER default_filter = NULL; |
512 // We install the post-dump callback only for the browser and service | 516 // We install the post-dump callback only for the browser and service |
513 // processes. It spawns a new browser/service process. | 517 // processes. It spawns a new browser/service process. |
514 if (process_type == L"browser") { | 518 if (process_type == L"browser") { |
515 callback = &DumpDoneCallback; | 519 callback = &DumpDoneCallback; |
516 default_filter = &ChromeExceptionFilter; | 520 default_filter = &ChromeExceptionFilter; |
517 } else if (process_type == L"service") { | 521 } else if (process_type == L"service") { |
518 callback = &DumpDoneCallback; | 522 callback = &DumpDoneCallback; |
519 default_filter = &ServiceExceptionFilter; | 523 default_filter = &ServiceExceptionFilter; |
520 } | 524 } |
521 | 525 |
522 if (process_type == L"browser") { | 526 if (process_type == L"browser") { |
523 InitPipeNameEnvVar(is_per_user_install); | 527 InitPipeNameEnvVar(is_per_user_install); |
524 GetBreakpadClient()->InitBrowserCrashDumpsRegKey(); | 528 GetCrashReporterClient()->InitBrowserCrashDumpsRegKey(); |
525 } | 529 } |
526 | 530 |
527 scoped_ptr<base::Environment> env(base::Environment::Create()); | 531 scoped_ptr<base::Environment> env(base::Environment::Create()); |
528 std::string pipe_name_ascii; | 532 std::string pipe_name_ascii; |
529 if (!env->GetVar(kPipeNameVar, &pipe_name_ascii)) { | 533 if (!env->GetVar(kPipeNameVar, &pipe_name_ascii)) { |
530 // Breakpad is not enabled. Configuration is managed or the user | 534 // Breakpad is not enabled. Configuration is managed or the user |
531 // did not allow Google Update to send crashes. We need to use | 535 // did not allow Google Update to send crashes. We need to use |
532 // our default crash handler instead, but only for the | 536 // our default crash handler instead, but only for the |
533 // browser/service processes. | 537 // browser/service processes. |
534 if (default_filter) | 538 if (default_filter) |
(...skipping 12 matching lines...) Expand all Loading... |
547 #endif | 551 #endif |
548 | 552 |
549 // Get the alternate dump directory. We use the temp path. | 553 // Get the alternate dump directory. We use the temp path. |
550 wchar_t temp_dir[MAX_PATH] = {0}; | 554 wchar_t temp_dir[MAX_PATH] = {0}; |
551 ::GetTempPathW(MAX_PATH, temp_dir); | 555 ::GetTempPathW(MAX_PATH, temp_dir); |
552 | 556 |
553 MINIDUMP_TYPE dump_type = kSmallDumpType; | 557 MINIDUMP_TYPE dump_type = kSmallDumpType; |
554 // Capture full memory if explicitly instructed to. | 558 // Capture full memory if explicitly instructed to. |
555 if (command.HasSwitch(switches::kFullMemoryCrashReport)) | 559 if (command.HasSwitch(switches::kFullMemoryCrashReport)) |
556 dump_type = kFullDumpType; | 560 dump_type = kFullDumpType; |
557 else if (GetBreakpadClient()->GetShouldDumpLargerDumps(is_per_user_install)) | 561 else if (GetCrashReporterClient()->GetShouldDumpLargerDumps( |
| 562 is_per_user_install)) |
558 dump_type = kLargerDumpType; | 563 dump_type = kLargerDumpType; |
559 | 564 |
560 g_breakpad = new google_breakpad::ExceptionHandler(temp_dir, &FilterCallback, | 565 g_breakpad = new google_breakpad::ExceptionHandler(temp_dir, &FilterCallback, |
561 callback, NULL, | 566 callback, NULL, |
562 google_breakpad::ExceptionHandler::HANDLER_ALL, | 567 google_breakpad::ExceptionHandler::HANDLER_ALL, |
563 dump_type, pipe_name.c_str(), custom_info); | 568 dump_type, pipe_name.c_str(), custom_info); |
564 | 569 |
565 // Now initialize the non crash dump handler. | 570 // Now initialize the non crash dump handler. |
566 g_dumphandler_no_crash = new google_breakpad::ExceptionHandler(temp_dir, | 571 g_dumphandler_no_crash = new google_breakpad::ExceptionHandler(temp_dir, |
567 &FilterCallbackWhenNoCrash, | 572 &FilterCallbackWhenNoCrash, |
(...skipping 12 matching lines...) Expand all Loading... |
580 base::debug::SetDumpWithoutCrashingFunction(&DumpProcessWithoutCrash); | 585 base::debug::SetDumpWithoutCrashingFunction(&DumpProcessWithoutCrash); |
581 | 586 |
582 if (g_breakpad->IsOutOfProcess()) { | 587 if (g_breakpad->IsOutOfProcess()) { |
583 // Tells breakpad to handle breakpoint and single step exceptions. | 588 // Tells breakpad to handle breakpoint and single step exceptions. |
584 // This might break JIT debuggers, but at least it will always | 589 // This might break JIT debuggers, but at least it will always |
585 // generate a crashdump for these exceptions. | 590 // generate a crashdump for these exceptions. |
586 g_breakpad->set_handle_debug_exceptions(true); | 591 g_breakpad->set_handle_debug_exceptions(true); |
587 | 592 |
588 #ifndef _WIN64 | 593 #ifndef _WIN64 |
589 if (process_type != L"browser" && | 594 if (process_type != L"browser" && |
590 !GetBreakpadClient()->IsRunningUnattended()) { | 595 !GetCrashReporterClient()->IsRunningUnattended()) { |
591 // Initialize the hook TerminateProcess to catch unexpected exits. | 596 // Initialize the hook TerminateProcess to catch unexpected exits. |
592 InitTerminateProcessHooks(); | 597 InitTerminateProcessHooks(); |
593 } | 598 } |
594 #endif | 599 #endif |
595 } | 600 } |
596 } | 601 } |
597 | 602 |
598 // If the user has disabled crash reporting uploads and restarted Chrome, the | 603 // If the user has disabled crash reporting uploads and restarted Chrome, the |
599 // restarted instance will still contain the pipe environment variable, which | 604 // restarted instance will still contain the pipe environment variable, which |
600 // will allow the restarted process to still upload crash reports. This function | 605 // will allow the restarted process to still upload crash reports. This function |
601 // clears the environment variable, so that the restarted Chrome, which inherits | 606 // clears the environment variable, so that the restarted Chrome, which inherits |
602 // its environment from the current Chrome, will no longer contain the variable. | 607 // its environment from the current Chrome, will no longer contain the variable. |
603 extern "C" void __declspec(dllexport) __cdecl | 608 extern "C" void __declspec(dllexport) __cdecl |
604 ClearBreakpadPipeEnvironmentVariable() { | 609 ClearBreakpadPipeEnvironmentVariable() { |
605 scoped_ptr<base::Environment> env(base::Environment::Create()); | 610 scoped_ptr<base::Environment> env(base::Environment::Create()); |
606 env->UnSetVar(kPipeNameVar); | 611 env->UnSetVar(kPipeNameVar); |
607 } | 612 } |
608 | 613 |
609 } // namespace breakpad | 614 } // namespace breakpad |
OLD | NEW |