Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/cpu.h" | 12 #include "base/cpu.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 18 #include "base/metrics/statistics_recorder.h" | 18 #include "base/metrics/statistics_recorder.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/process/memory.h" | 20 #include "base/process/memory.h" |
| 21 #include "base/process/process_handle.h" | 21 #include "base/process/process_handle.h" |
| 22 #include "base/process/process_info.h" | 22 #include "base/process/process_info.h" |
| 23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 25 #include "base/trace_event/trace_event_impl.h" | 25 #include "base/trace_event/trace_event_impl.h" |
| 26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 27 #include "chrome/browser/chrome_content_browser_client.h" | 27 #include "chrome/browser/chrome_content_browser_client.h" |
| 28 #include "chrome/browser/defaults.h" | 28 #include "chrome/browser/defaults.h" |
| 29 #include "chrome/child/child_profiling.h" | |
| 29 #include "chrome/common/channel_info.h" | 30 #include "chrome/common/channel_info.h" |
| 30 #include "chrome/common/chrome_constants.h" | 31 #include "chrome/common/chrome_constants.h" |
| 31 #include "chrome/common/chrome_content_client.h" | 32 #include "chrome/common/chrome_content_client.h" |
| 32 #include "chrome/common/chrome_paths.h" | 33 #include "chrome/common/chrome_paths.h" |
| 33 #include "chrome/common/chrome_paths_internal.h" | 34 #include "chrome/common/chrome_paths_internal.h" |
| 34 #include "chrome/common/chrome_result_codes.h" | 35 #include "chrome/common/chrome_result_codes.h" |
| 35 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
| 36 #include "chrome/common/crash_keys.h" | 37 #include "chrome/common/crash_keys.h" |
| 37 #include "chrome/common/features.h" | 38 #include "chrome/common/features.h" |
| 38 #include "chrome/common/logging_chrome.h" | 39 #include "chrome/common/logging_chrome.h" |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 521 #if defined(OS_MACOSX) | 522 #if defined(OS_MACOSX) |
| 522 // Give the browser process a longer treadmill, since crashes | 523 // Give the browser process a longer treadmill, since crashes |
| 523 // there have more impact. | 524 // there have more impact. |
| 524 const bool is_browser = !command_line.HasSwitch(switches::kProcessType); | 525 const bool is_browser = !command_line.HasSwitch(switches::kProcessType); |
| 525 ObjcEvilDoers::ZombieEnable(true, is_browser ? 10000 : 1000); | 526 ObjcEvilDoers::ZombieEnable(true, is_browser ? 10000 : 1000); |
| 526 | 527 |
| 527 SetUpBundleOverrides(); | 528 SetUpBundleOverrides(); |
| 528 chrome::common::mac::EnableCFBundleBlocker(); | 529 chrome::common::mac::EnableCFBundleBlocker(); |
| 529 #endif | 530 #endif |
| 530 | 531 |
| 532 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) | |
|
Nico
2017/01/13 21:01:19
if this is mechanical, why does this have the !def
scottmg
2017/01/13 21:55:08
You're right, not entirely mechanical I guess. Thi
Nico
2017/01/17 13:10:42
Maybe add a comment explaining why this is ifdef'd
| |
| 533 ChildProfiling::ProcessStarted(); | |
| 534 #endif | |
| 531 Profiling::ProcessStarted(); | 535 Profiling::ProcessStarted(); |
| 532 | 536 |
| 533 base::trace_event::TraceLog::GetInstance()->SetArgumentFilterPredicate( | 537 base::trace_event::TraceLog::GetInstance()->SetArgumentFilterPredicate( |
| 534 base::Bind(&IsTraceEventArgsWhitelisted)); | 538 base::Bind(&IsTraceEventArgsWhitelisted)); |
| 535 | 539 |
| 536 #if defined(OS_WIN) && !defined(CHROME_MULTIPLE_DLL_BROWSER) | 540 #if defined(OS_WIN) && !defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 537 v8_breakpad_support::SetUp(); | 541 v8_breakpad_support::SetUp(); |
| 538 #endif | 542 #endif |
| 539 | 543 |
| 540 #if defined(OS_POSIX) | 544 #if defined(OS_POSIX) |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1010 #if defined(OS_CHROMEOS) | 1014 #if defined(OS_CHROMEOS) |
| 1011 chromeos::ReloadElfTextInHugePages(); | 1015 chromeos::ReloadElfTextInHugePages(); |
| 1012 #endif | 1016 #endif |
| 1013 | 1017 |
| 1014 #if !defined(DISABLE_NACL) | 1018 #if !defined(DISABLE_NACL) |
| 1015 nacl::AddNaClZygoteForkDelegates(delegates); | 1019 nacl::AddNaClZygoteForkDelegates(delegates); |
| 1016 #endif | 1020 #endif |
| 1017 } | 1021 } |
| 1018 | 1022 |
| 1019 void ChromeMainDelegate::ZygoteForked() { | 1023 void ChromeMainDelegate::ZygoteForked() { |
| 1024 ChildProfiling::ProcessStarted(); | |
| 1020 Profiling::ProcessStarted(); | 1025 Profiling::ProcessStarted(); |
| 1021 if (Profiling::BeingProfiled()) { | 1026 if (Profiling::BeingProfiled()) { |
| 1022 base::debug::RestartProfilingAfterFork(); | 1027 base::debug::RestartProfilingAfterFork(); |
| 1023 SetUpProfilingShutdownHandler(); | 1028 SetUpProfilingShutdownHandler(); |
| 1024 } | 1029 } |
| 1025 | 1030 |
| 1026 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets | 1031 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets |
| 1027 // this up for the browser process in a different manner. | 1032 // this up for the browser process in a different manner. |
| 1028 const base::CommandLine* command_line = | 1033 const base::CommandLine* command_line = |
| 1029 base::CommandLine::ForCurrentProcess(); | 1034 base::CommandLine::ForCurrentProcess(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1078 case version_info::Channel::CANARY: | 1083 case version_info::Channel::CANARY: |
| 1079 return true; | 1084 return true; |
| 1080 case version_info::Channel::DEV: | 1085 case version_info::Channel::DEV: |
| 1081 case version_info::Channel::BETA: | 1086 case version_info::Channel::BETA: |
| 1082 case version_info::Channel::STABLE: | 1087 case version_info::Channel::STABLE: |
| 1083 default: | 1088 default: |
| 1084 // Don't enable instrumentation. | 1089 // Don't enable instrumentation. |
| 1085 return false; | 1090 return false; |
| 1086 } | 1091 } |
| 1087 } | 1092 } |
| OLD | NEW |