OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // TODO(port): the ifdefs in here are a first step towards trying to determine | 5 // TODO(port): the ifdefs in here are a first step towards trying to determine |
6 // the correct abstraction for all the OS functionality required at this | 6 // the correct abstraction for all the OS functionality required at this |
7 // stage of process initialization. It should not be taken as a final | 7 // stage of process initialization. It should not be taken as a final |
8 // abstraction. | 8 // abstraction. |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 // * If Breakpad is disabled, we only turn on Crash Reporter for the | 641 // * If Breakpad is disabled, we only turn on Crash Reporter for the |
642 // Browser process in release mode. | 642 // Browser process in release mode. |
643 if (!parsed_command_line.HasSwitch(switches::kDisableBreakpad)) { | 643 if (!parsed_command_line.HasSwitch(switches::kDisableBreakpad)) { |
644 bool disable_apple_crash_reporter = is_debug_build | 644 bool disable_apple_crash_reporter = is_debug_build |
645 || mac_util::IsBackgroundOnlyProcess(); | 645 || mac_util::IsBackgroundOnlyProcess(); |
646 if (!IsCrashReporterEnabled() && disable_apple_crash_reporter) { | 646 if (!IsCrashReporterEnabled() && disable_apple_crash_reporter) { |
647 DebugUtil::DisableOSCrashDumps(); | 647 DebugUtil::DisableOSCrashDumps(); |
648 } | 648 } |
649 } | 649 } |
650 | 650 |
| 651 #if defined(OS_MACOSX) |
| 652 // Mac Chrome is packaged with a main app bundle and a helper app bundle. |
| 653 // The main app bundle should only be used for the browser process, so it |
| 654 // should never see a --type switch (switches::kProcessType). Likewise, |
| 655 // the helper should always have a --type switch. |
| 656 // |
| 657 // This check is done this late so there is already a call to |
| 658 // mac_util::IsBackgroundOnlyProcess(), so there is no change in |
| 659 // startup/initialization order. |
| 660 |
| 661 // The helper's Info.plist marks it as a background only app. |
| 662 if (mac_util::IsBackgroundOnlyProcess()) { |
| 663 CHECK(parsed_command_line.HasSwitch(switches::kProcessType)) |
| 664 << "Helper application requires --type."; |
| 665 } else { |
| 666 CHECK(!parsed_command_line.HasSwitch(switches::kProcessType)) |
| 667 << "Main application forbids --type, saw \"" << process_type << "\"."; |
| 668 } |
| 669 #endif // defined(OS_MACOSX) |
| 670 |
651 if (IsCrashReporterEnabled()) | 671 if (IsCrashReporterEnabled()) |
652 InitCrashProcessInfo(); | 672 InitCrashProcessInfo(); |
653 #endif // OS_MACOSX | 673 #endif // OS_MACOSX |
654 | 674 |
655 InitializeStatsTable(browser_pid, parsed_command_line); | 675 InitializeStatsTable(browser_pid, parsed_command_line); |
656 | 676 |
657 StatsScope<StatsCounterTimer> | 677 StatsScope<StatsCounterTimer> |
658 startup_timer(chrome::Counters::chrome_main()); | 678 startup_timer(chrome::Counters::chrome_main()); |
659 | 679 |
660 // Enable the heap profiler as early as possible! | 680 // Enable the heap profiler as early as possible! |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 | 935 |
916 logging::CleanupChromeLogging(); | 936 logging::CleanupChromeLogging(); |
917 | 937 |
918 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) | 938 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) |
919 // TODO(mark): See the TODO(mark) above at InitCrashReporter. | 939 // TODO(mark): See the TODO(mark) above at InitCrashReporter. |
920 DestructCrashReporter(); | 940 DestructCrashReporter(); |
921 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD | 941 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD |
922 | 942 |
923 return rv; | 943 return rv; |
924 } | 944 } |
OLD | NEW |