| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 // The Breakpad pipe name is already configured: nothing to do. | 449 // The Breakpad pipe name is already configured: nothing to do. |
| 450 return; | 450 return; |
| 451 } | 451 } |
| 452 | 452 |
| 453 // Check whether configuration management controls crash reporting. | 453 // Check whether configuration management controls crash reporting. |
| 454 bool crash_reporting_enabled = true; | 454 bool crash_reporting_enabled = true; |
| 455 bool controlled_by_policy = | 455 bool controlled_by_policy = |
| 456 GetCrashReporterClient()->ReportingIsEnforcedByPolicy( | 456 GetCrashReporterClient()->ReportingIsEnforcedByPolicy( |
| 457 &crash_reporting_enabled); | 457 &crash_reporting_enabled); |
| 458 | 458 |
| 459 const CommandLine& command = *CommandLine::ForCurrentProcess(); | 459 const base::CommandLine& command = *base::CommandLine::ForCurrentProcess(); |
| 460 bool use_crash_service = !controlled_by_policy && | 460 bool use_crash_service = !controlled_by_policy && |
| 461 (command.HasSwitch(switches::kNoErrorDialogs) || | 461 (command.HasSwitch(switches::kNoErrorDialogs) || |
| 462 GetCrashReporterClient()->IsRunningUnattended()); | 462 GetCrashReporterClient()->IsRunningUnattended()); |
| 463 | 463 |
| 464 std::wstring pipe_name; | 464 std::wstring pipe_name; |
| 465 if (use_crash_service) { | 465 if (use_crash_service) { |
| 466 // Crash reporting is done by crash_service.exe. | 466 // Crash reporting is done by crash_service.exe. |
| 467 pipe_name = kChromePipeName; | 467 pipe_name = kChromePipeName; |
| 468 } else { | 468 } else { |
| 469 // We want to use the Google Update crash reporting. We need to check if the | 469 // We want to use the Google Update crash reporting. We need to check if the |
| (...skipping 24 matching lines...) Expand all Loading... |
| 494 pipe_name += user_sid; | 494 pipe_name += user_sid; |
| 495 } | 495 } |
| 496 env->SetVar(kPipeNameVar, base::UTF16ToASCII(pipe_name)); | 496 env->SetVar(kPipeNameVar, base::UTF16ToASCII(pipe_name)); |
| 497 } | 497 } |
| 498 | 498 |
| 499 void InitDefaultCrashCallback(LPTOP_LEVEL_EXCEPTION_FILTER filter) { | 499 void InitDefaultCrashCallback(LPTOP_LEVEL_EXCEPTION_FILTER filter) { |
| 500 previous_filter = SetUnhandledExceptionFilter(filter); | 500 previous_filter = SetUnhandledExceptionFilter(filter); |
| 501 } | 501 } |
| 502 | 502 |
| 503 void InitCrashReporter(const std::string& process_type_switch) { | 503 void InitCrashReporter(const std::string& process_type_switch) { |
| 504 const CommandLine& command = *CommandLine::ForCurrentProcess(); | 504 const base::CommandLine& command = *base::CommandLine::ForCurrentProcess(); |
| 505 if (command.HasSwitch(switches::kDisableBreakpad)) | 505 if (command.HasSwitch(switches::kDisableBreakpad)) |
| 506 return; | 506 return; |
| 507 | 507 |
| 508 // Disable the message box for assertions. | 508 // Disable the message box for assertions. |
| 509 _CrtSetReportMode(_CRT_ASSERT, 0); | 509 _CrtSetReportMode(_CRT_ASSERT, 0); |
| 510 | 510 |
| 511 base::string16 process_type = base::ASCIIToUTF16(process_type_switch); | 511 base::string16 process_type = base::ASCIIToUTF16(process_type_switch); |
| 512 if (process_type.empty()) | 512 if (process_type.empty()) |
| 513 process_type = L"browser"; | 513 process_type = L"browser"; |
| 514 | 514 |
| 515 wchar_t exe_path[MAX_PATH]; | 515 wchar_t exe_path[MAX_PATH]; |
| 516 exe_path[0] = 0; | 516 exe_path[0] = 0; |
| 517 GetModuleFileNameW(NULL, exe_path, MAX_PATH); | 517 GetModuleFileNameW(NULL, exe_path, MAX_PATH); |
| 518 | 518 |
| 519 bool is_per_user_install = | 519 bool is_per_user_install = |
| 520 GetCrashReporterClient()->GetIsPerUserInstall(base::FilePath(exe_path)); | 520 GetCrashReporterClient()->GetIsPerUserInstall(base::FilePath(exe_path)); |
| 521 | 521 |
| 522 // This is intentionally leaked. | 522 // This is intentionally leaked. |
| 523 CrashKeysWin* keeper = new CrashKeysWin(); | 523 CrashKeysWin* keeper = new CrashKeysWin(); |
| 524 | 524 |
| 525 google_breakpad::CustomClientInfo* custom_info = | 525 google_breakpad::CustomClientInfo* custom_info = |
| 526 keeper->GetCustomInfo(exe_path, process_type, | 526 keeper->GetCustomInfo(exe_path, process_type, GetProfileType(), |
| 527 GetProfileType(), CommandLine::ForCurrentProcess(), | 527 base::CommandLine::ForCurrentProcess(), |
| 528 GetCrashReporterClient()); | 528 GetCrashReporterClient()); |
| 529 | 529 |
| 530 google_breakpad::ExceptionHandler::MinidumpCallback callback = NULL; | 530 google_breakpad::ExceptionHandler::MinidumpCallback callback = NULL; |
| 531 LPTOP_LEVEL_EXCEPTION_FILTER default_filter = NULL; | 531 LPTOP_LEVEL_EXCEPTION_FILTER default_filter = NULL; |
| 532 // We install the post-dump callback only for the browser and service | 532 // We install the post-dump callback only for the browser and service |
| 533 // processes. It spawns a new browser/service process. | 533 // processes. It spawns a new browser/service process. |
| 534 if (process_type == L"browser") { | 534 if (process_type == L"browser") { |
| 535 callback = &DumpDoneCallback; | 535 callback = &DumpDoneCallback; |
| 536 default_filter = &ChromeExceptionFilter; | 536 default_filter = &ChromeExceptionFilter; |
| 537 } else if (process_type == L"service") { | 537 } else if (process_type == L"service") { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 extern "C" void __declspec(dllexport) __cdecl | 690 extern "C" void __declspec(dllexport) __cdecl |
| 691 UnregisterNonABICompliantCodeRange(void* start) { | 691 UnregisterNonABICompliantCodeRange(void* start) { |
| 692 ExceptionHandlerRecord* record = | 692 ExceptionHandlerRecord* record = |
| 693 reinterpret_cast<ExceptionHandlerRecord*>(start); | 693 reinterpret_cast<ExceptionHandlerRecord*>(start); |
| 694 | 694 |
| 695 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); | 695 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); |
| 696 } | 696 } |
| 697 #endif | 697 #endif |
| 698 | 698 |
| 699 } // namespace breakpad | 699 } // namespace breakpad |
| OLD | NEW |