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

Side by Side Diff: chrome/app/chrome_main_delegate.cc

Issue 1001103002: Crashpad! (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sign crashpad_handler Created 5 years, 9 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
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/chrome_main_delegate.h" 5 #include "chrome/app/chrome_main_delegate.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/cpu.h" 9 #include "base/cpu.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include <algorithm> 47 #include <algorithm>
48 #include "chrome/app/close_handle_hook_win.h" 48 #include "chrome/app/close_handle_hook_win.h"
49 #include "chrome/common/child_process_logging.h" 49 #include "chrome/common/child_process_logging.h"
50 #include "chrome/common/v8_breakpad_support_win.h" 50 #include "chrome/common/v8_breakpad_support_win.h"
51 #include "sandbox/win/src/sandbox.h" 51 #include "sandbox/win/src/sandbox.h"
52 #include "ui/base/resource/resource_bundle_win.h" 52 #include "ui/base/resource/resource_bundle_win.h"
53 #endif 53 #endif
54 54
55 #if defined(OS_MACOSX) 55 #if defined(OS_MACOSX)
56 #include "base/mac/foundation_util.h" 56 #include "base/mac/foundation_util.h"
57 #include "base/mac/os_crash_dumps.h"
58 #include "chrome/app/chrome_main_mac.h" 57 #include "chrome/app/chrome_main_mac.h"
59 #include "chrome/browser/mac/relauncher.h" 58 #include "chrome/browser/mac/relauncher.h"
60 #include "chrome/common/mac/cfbundle_blocker.h" 59 #include "chrome/common/mac/cfbundle_blocker.h"
61 #include "chrome/common/mac/objc_zombie.h" 60 #include "chrome/common/mac/objc_zombie.h"
62 #include "components/crash/app/breakpad_mac.h" 61 #include "components/crash/app/crashpad_mac.h"
63 #include "ui/base/l10n/l10n_util_mac.h" 62 #include "ui/base/l10n/l10n_util_mac.h"
64 #endif 63 #endif
65 64
66 #if defined(OS_POSIX) 65 #if defined(OS_POSIX)
67 #include <locale.h> 66 #include <locale.h>
68 #include <signal.h> 67 #include <signal.h>
69 #include "chrome/app/chrome_crash_reporter_client.h" 68 #include "chrome/app/chrome_crash_reporter_client.h"
70 #include "components/crash/app/crash_reporter_client.h" 69 #include "components/crash/app/crash_reporter_client.h"
71 #endif 70 #endif
72 71
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 549
551 content::SetContentClient(&chrome_content_client_); 550 content::SetContentClient(&chrome_content_client_);
552 551
553 return false; 552 return false;
554 } 553 }
555 554
556 #if defined(OS_MACOSX) 555 #if defined(OS_MACOSX)
557 void ChromeMainDelegate::InitMacCrashReporter( 556 void ChromeMainDelegate::InitMacCrashReporter(
558 const base::CommandLine& command_line, 557 const base::CommandLine& command_line,
559 const std::string& process_type) { 558 const std::string& process_type) {
560 // TODO(mark): Right now, InitCrashReporter() needs to be called after 559 // TODO(mark): Right now, InitializeCrashpad() needs to be called after
561 // CommandLine::Init() and chrome::RegisterPathProvider(). Ideally, 560 // CommandLine::Init() and chrome::RegisterPathProvider(). Ideally, Crashpad
562 // Breakpad initialization could occur sooner, preferably even before the 561 // initialization could occur sooner, preferably even before the framework
563 // framework dylib is even loaded, to catch potential early crashes. 562 // dylib is even loaded, to catch potential early crashes.
564 breakpad::InitCrashReporter(process_type); 563 crash_reporter::InitializeCrashpad(process_type);
565
566 #if defined(NDEBUG)
567 bool is_debug_build = false;
568 #else
569 bool is_debug_build = true;
570 #endif
571
572 // Details on when we enable Apple's Crash reporter.
573 //
574 // Motivation:
575 // In debug mode it takes Apple's crash reporter eons to generate a crash
576 // dump.
577 //
578 // What we do:
579 // * We only pass crashes for foreground processes to Apple's Crash
580 // reporter. At the time of this writing, that means just the Browser
581 // process.
582 // * If Breakpad is enabled, it will pass browser crashes to Crash Reporter
583 // itself.
584 // * If Breakpad is disabled, we only turn on Crash Reporter for the
585 // Browser process in release mode.
586 if (!command_line.HasSwitch(switches::kDisableBreakpad)) {
587 bool disable_apple_crash_reporter = is_debug_build ||
588 base::mac::IsBackgroundOnlyProcess();
589 if (!breakpad::IsCrashReporterEnabled() && disable_apple_crash_reporter) {
590 base::mac::DisableOSCrashDumps();
591 }
592 }
593 564
594 // Mac Chrome is packaged with a main app bundle and a helper app bundle. 565 // Mac Chrome is packaged with a main app bundle and a helper app bundle.
595 // The main app bundle should only be used for the browser process, so it 566 // The main app bundle should only be used for the browser process, so it
596 // should never see a --type switch (switches::kProcessType). Likewise, 567 // should never see a --type switch (switches::kProcessType). Likewise,
597 // the helper should always have a --type switch. 568 // the helper should always have a --type switch.
598 // 569 //
599 // This check is done this late so there is already a call to 570 // This check is done this late so there is already a call to
600 // base::mac::IsBackgroundOnlyProcess(), so there is no change in 571 // base::mac::IsBackgroundOnlyProcess(), so there is no change in
601 // startup/initialization order. 572 // startup/initialization order.
602 573
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 << switches::kPluginProcess << " and " 608 << switches::kPluginProcess << " and "
638 << switches::kNaClLoaderProcess << ", saw " << process_type; 609 << switches::kNaClLoaderProcess << ", saw " << process_type;
639 #endif 610 #endif
640 } 611 }
641 } 612 }
642 } else { 613 } else {
643 CHECK(!command_line.HasSwitch(switches::kProcessType) && 614 CHECK(!command_line.HasSwitch(switches::kProcessType) &&
644 process_type.empty()) 615 process_type.empty())
645 << "Main application forbids --type, saw " << process_type; 616 << "Main application forbids --type, saw " << process_type;
646 } 617 }
647
648 if (breakpad::IsCrashReporterEnabled())
649 breakpad::InitCrashProcessInfo(process_type);
650 } 618 }
651 #endif // defined(OS_MACOSX) 619 #endif // defined(OS_MACOSX)
652 620
653 void ChromeMainDelegate::PreSandboxStartup() { 621 void ChromeMainDelegate::PreSandboxStartup() {
654 const base::CommandLine& command_line = 622 const base::CommandLine& command_line =
655 *base::CommandLine::ForCurrentProcess(); 623 *base::CommandLine::ForCurrentProcess();
656 std::string process_type = 624 std::string process_type =
657 command_line.GetSwitchValueASCII(switches::kProcessType); 625 command_line.GetSwitchValueASCII(switches::kProcessType);
658 626
659 #if defined(OS_POSIX) 627 #if defined(OS_POSIX)
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 } 932 }
965 933
966 content::ContentUtilityClient* 934 content::ContentUtilityClient*
967 ChromeMainDelegate::CreateContentUtilityClient() { 935 ChromeMainDelegate::CreateContentUtilityClient() {
968 #if defined(CHROME_MULTIPLE_DLL_BROWSER) 936 #if defined(CHROME_MULTIPLE_DLL_BROWSER)
969 return NULL; 937 return NULL;
970 #else 938 #else
971 return g_chrome_content_utility_client.Pointer(); 939 return g_chrome_content_utility_client.Pointer();
972 #endif 940 #endif
973 } 941 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_crash_reporter_client_mac.mm ('k') | chrome/browser/chrome_browser_main_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698