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

Side by Side Diff: components/crash/app/breakpad_win.cc

Issue 762723003: Prefix CommandLine usage with base namespace (Part 8: components) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « components/crash/app/breakpad_mac.mm ('k') | components/crash/tools/crash_service.cc » ('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 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
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
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
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
OLDNEW
« no previous file with comments | « components/crash/app/breakpad_mac.mm ('k') | components/crash/tools/crash_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698