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 "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 22 matching lines...) Expand all Loading... | |
| 33 #include "chrome/common/logging_chrome.h" | 33 #include "chrome/common/logging_chrome.h" |
| 34 #include "chrome/common/profiling.h" | 34 #include "chrome/common/profiling.h" |
| 35 #include "chrome/common/switch_utils.h" | 35 #include "chrome/common/switch_utils.h" |
| 36 #include "chrome/common/trace_event_args_whitelist.h" | 36 #include "chrome/common/trace_event_args_whitelist.h" |
| 37 #include "chrome/common/url_constants.h" | 37 #include "chrome/common/url_constants.h" |
| 38 #include "chrome/plugin/chrome_content_plugin_client.h" | 38 #include "chrome/plugin/chrome_content_plugin_client.h" |
| 39 #include "chrome/renderer/chrome_content_renderer_client.h" | 39 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 40 #include "chrome/utility/chrome_content_utility_client.h" | 40 #include "chrome/utility/chrome_content_utility_client.h" |
| 41 #include "components/component_updater/component_updater_paths.h" | 41 #include "components/component_updater/component_updater_paths.h" |
| 42 #include "components/content_settings/core/common/content_settings_pattern.h" | 42 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 43 #include "components/startup_metric_utils/startup_metric_utils.h" | |
| 44 #include "components/version_info/version_info.h" | 43 #include "components/version_info/version_info.h" |
| 45 #include "content/public/common/content_client.h" | 44 #include "content/public/common/content_client.h" |
| 46 #include "content/public/common/content_paths.h" | 45 #include "content/public/common/content_paths.h" |
| 47 #include "content/public/common/content_switches.h" | 46 #include "content/public/common/content_switches.h" |
| 48 #include "extensions/common/constants.h" | 47 #include "extensions/common/constants.h" |
| 49 #include "ui/base/resource/resource_bundle.h" | 48 #include "ui/base/resource/resource_bundle.h" |
| 50 #include "ui/base/ui_base_switches.h" | 49 #include "ui/base/ui_base_switches.h" |
| 51 | 50 |
| 52 #if defined(OS_WIN) | 51 #if defined(OS_WIN) |
| 53 #include <atlbase.h> | 52 #include <atlbase.h> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 #if !defined(DISABLE_NACL) | 118 #if !defined(DISABLE_NACL) |
| 120 #include "components/nacl/common/nacl_switches.h" | 119 #include "components/nacl/common/nacl_switches.h" |
| 121 #include "components/nacl/renderer/plugin/ppapi_entrypoints.h" | 120 #include "components/nacl/renderer/plugin/ppapi_entrypoints.h" |
| 122 #endif | 121 #endif |
| 123 | 122 |
| 124 #if defined(ENABLE_PLUGINS) && (defined(CHROME_MULTIPLE_DLL_CHILD) || \ | 123 #if defined(ENABLE_PLUGINS) && (defined(CHROME_MULTIPLE_DLL_CHILD) || \ |
| 125 !defined(CHROME_MULTIPLE_DLL_BROWSER)) | 124 !defined(CHROME_MULTIPLE_DLL_BROWSER)) |
| 126 #include "pdf/pdf.h" | 125 #include "pdf/pdf.h" |
| 127 #endif | 126 #endif |
| 128 | 127 |
| 128 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | |
| 129 #include "components/startup_metric_utils/browser/startup_metric_utils.h" | |
| 130 #endif | |
| 131 | |
| 129 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) | 132 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 130 #include "chrome/child/pdf_child_init.h" | 133 #include "chrome/child/pdf_child_init.h" |
| 131 | 134 |
| 132 base::LazyInstance<ChromeContentRendererClient> | 135 base::LazyInstance<ChromeContentRendererClient> |
| 133 g_chrome_content_renderer_client = LAZY_INSTANCE_INITIALIZER; | 136 g_chrome_content_renderer_client = LAZY_INSTANCE_INITIALIZER; |
| 134 base::LazyInstance<ChromeContentUtilityClient> | 137 base::LazyInstance<ChromeContentUtilityClient> |
| 135 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; | 138 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; |
| 136 base::LazyInstance<ChromeContentPluginClient> | 139 base::LazyInstance<ChromeContentPluginClient> |
| 137 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; | 140 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; |
| 138 #endif | 141 #endif |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 logging::APPEND_TO_OLD_LOG_FILE; | 399 logging::APPEND_TO_OLD_LOG_FILE; |
| 397 if (process_type.empty()) { | 400 if (process_type.empty()) { |
| 398 file_state = logging::DELETE_OLD_LOG_FILE; | 401 file_state = logging::DELETE_OLD_LOG_FILE; |
| 399 } | 402 } |
| 400 const base::CommandLine& command_line = | 403 const base::CommandLine& command_line = |
| 401 *base::CommandLine::ForCurrentProcess(); | 404 *base::CommandLine::ForCurrentProcess(); |
| 402 logging::InitChromeLogging(command_line, file_state); | 405 logging::InitChromeLogging(command_line, file_state); |
| 403 } | 406 } |
| 404 #endif | 407 #endif |
| 405 | 408 |
| 406 } // namespace | 409 #if !defined(CHROME_MULTIPLE_DLL_CHILD) |
| 407 | 410 void RecordMainStartupMetrics() { |
| 408 ChromeMainDelegate::ChromeMainDelegate() { | |
| 409 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) | 411 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) |
| 410 // Record the startup process creation time on supported platforms. | 412 // Record the startup process creation time on supported platforms. |
| 411 startup_metric_utils::RecordStartupProcessCreationTime( | 413 startup_metric_utils::RecordStartupProcessCreationTime( |
| 412 base::CurrentProcessInfo::CreationTime()); | 414 base::CurrentProcessInfo::CreationTime()); |
| 413 #endif | 415 #endif |
| 414 | 416 |
| 415 // On Android the main entry point time is the time when the Java code starts. | 417 // On Android the main entry point time is the time when the Java code starts. |
| 416 // This happens before the shared library containing this code is even loaded. | 418 // This happens before the shared library containing this code is even loaded. |
| 417 // The Java startup code has recorded that time, but the C++ code can't fetch it | 419 // The Java startup code has recorded that time, but the C++ code can't fetch it |
| 418 // from the Java side until it has initialized the JNI. See | 420 // from the Java side until it has initialized the JNI. See |
| 419 // ChromeMainDelegateAndroid. | 421 // ChromeMainDelegateAndroid. |
| 420 #if !defined(OS_ANDROID) | 422 #if !defined(OS_ANDROID) |
| 421 startup_metric_utils::RecordMainEntryPointTime(base::Time::Now()); | 423 startup_metric_utils::RecordMainEntryPointTime(base::Time::Now()); |
| 422 #endif | 424 #endif |
| 423 } | 425 } |
| 426 #endif // !defined(CHROME_MULTIPLE_DLL_CHILD) | |
| 427 | |
| 428 } // namespace | |
| 429 | |
| 430 ChromeMainDelegate::ChromeMainDelegate() { | |
| 431 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | |
| 432 // Record startup metrics in the browser process. For component builds, there | |
| 433 // is no way to know the type of process (process command line is not yet | |
| 434 // initialized), so the function below will also be called in renderers. | |
|
fdoray
2015/10/30 18:15:31
process command line initialized here: content::Co
| |
| 435 // This doesn't matter as it simply sets global variables. | |
| 436 RecordMainStartupMetrics(); | |
| 437 #endif // !defined(CHROME_MULTIPLE_DLL_CHILD) | |
| 438 } | |
| 424 | 439 |
| 425 ChromeMainDelegate::~ChromeMainDelegate() { | 440 ChromeMainDelegate::~ChromeMainDelegate() { |
| 426 } | 441 } |
| 427 | 442 |
| 428 bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) { | 443 bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) { |
| 429 #if defined(OS_CHROMEOS) | 444 #if defined(OS_CHROMEOS) |
| 430 chromeos::BootTimesRecorder::Get()->SaveChromeMainStats(); | 445 chromeos::BootTimesRecorder::Get()->SaveChromeMainStats(); |
| 431 #endif | 446 #endif |
| 432 | 447 |
| 433 const base::CommandLine& command_line = | 448 const base::CommandLine& command_line = |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 965 case version_info::Channel::CANARY: | 980 case version_info::Channel::CANARY: |
| 966 return true; | 981 return true; |
| 967 case version_info::Channel::DEV: | 982 case version_info::Channel::DEV: |
| 968 case version_info::Channel::BETA: | 983 case version_info::Channel::BETA: |
| 969 case version_info::Channel::STABLE: | 984 case version_info::Channel::STABLE: |
| 970 default: | 985 default: |
| 971 // Don't enable instrumentation. | 986 // Don't enable instrumentation. |
| 972 return false; | 987 return false; |
| 973 } | 988 } |
| 974 } | 989 } |
| OLD | NEW |