| 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" |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 if (process_type.empty()) { | 427 if (process_type.empty()) { |
| 428 file_state = logging::DELETE_OLD_LOG_FILE; | 428 file_state = logging::DELETE_OLD_LOG_FILE; |
| 429 } | 429 } |
| 430 const base::CommandLine& command_line = | 430 const base::CommandLine& command_line = |
| 431 *base::CommandLine::ForCurrentProcess(); | 431 *base::CommandLine::ForCurrentProcess(); |
| 432 logging::InitChromeLogging(command_line, file_state); | 432 logging::InitChromeLogging(command_line, file_state); |
| 433 } | 433 } |
| 434 #endif | 434 #endif |
| 435 | 435 |
| 436 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | 436 #if !defined(CHROME_MULTIPLE_DLL_CHILD) |
| 437 void RecordMainStartupMetrics() { | 437 void RecordMainStartupMetrics(int64_t exe_entry_point_ticks) { |
| 438 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) | 438 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) |
| 439 startup_metric_utils::RecordExeMainEntryPointTicks( |
| 440 base::TimeTicks::FromInternalValue(exe_entry_point_ticks)); |
| 439 // Record the startup process creation time on supported platforms. | 441 // Record the startup process creation time on supported platforms. |
| 440 startup_metric_utils::RecordStartupProcessCreationTime( | 442 startup_metric_utils::RecordStartupProcessCreationTime( |
| 441 base::CurrentProcessInfo::CreationTime()); | 443 base::CurrentProcessInfo::CreationTime()); |
| 442 #endif | 444 #endif |
| 443 | 445 |
| 444 // On Android the main entry point time is the time when the Java code starts. | 446 // On Android the main entry point time is the time when the Java code starts. |
| 445 // This happens before the shared library containing this code is even loaded. | 447 // This happens before the shared library containing this code is even loaded. |
| 446 // The Java startup code has recorded that time, but the C++ code can't fetch it | 448 // The Java startup code has recorded that time, but the C++ code can't fetch it |
| 447 // from the Java side until it has initialized the JNI. See | 449 // from the Java side until it has initialized the JNI. See |
| 448 // ChromeMainDelegateAndroid. | 450 // ChromeMainDelegateAndroid. |
| 449 #if !defined(OS_ANDROID) | 451 #if !defined(OS_ANDROID) |
| 450 startup_metric_utils::RecordMainEntryPointTime(base::Time::Now()); | 452 startup_metric_utils::RecordMainEntryPointTime(base::Time::Now()); |
| 451 #endif | 453 #endif |
| 452 } | 454 } |
| 453 #endif // !defined(CHROME_MULTIPLE_DLL_CHILD) | 455 #endif // !defined(CHROME_MULTIPLE_DLL_CHILD) |
| 454 | 456 |
| 455 } // namespace | 457 } // namespace |
| 456 | 458 |
| 457 ChromeMainDelegate::ChromeMainDelegate() { | 459 ChromeMainDelegate::ChromeMainDelegate(int64_t exe_entry_point_ticks) { |
| 458 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | 460 #if !defined(CHROME_MULTIPLE_DLL_CHILD) |
| 459 // Record startup metrics in the browser process. For component builds, there | 461 // Record startup metrics in the browser process. For component builds, there |
| 460 // is no way to know the type of process (process command line is not yet | 462 // is no way to know the type of process (process command line is not yet |
| 461 // initialized), so the function below will also be called in renderers. | 463 // initialized), so the function below will also be called in renderers. |
| 462 // This doesn't matter as it simply sets global variables. | 464 // This doesn't matter as it simply sets global variables. |
| 463 RecordMainStartupMetrics(); | 465 RecordMainStartupMetrics(exe_entry_point_ticks); |
| 464 #endif // !defined(CHROME_MULTIPLE_DLL_CHILD) | 466 #endif // !defined(CHROME_MULTIPLE_DLL_CHILD) |
| 465 } | 467 } |
| 466 | 468 |
| 467 ChromeMainDelegate::~ChromeMainDelegate() { | 469 ChromeMainDelegate::~ChromeMainDelegate() { |
| 468 } | 470 } |
| 469 | 471 |
| 470 bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) { | 472 bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) { |
| 471 #if defined(OS_CHROMEOS) | 473 #if defined(OS_CHROMEOS) |
| 472 chromeos::BootTimesRecorder::Get()->SaveChromeMainStats(); | 474 chromeos::BootTimesRecorder::Get()->SaveChromeMainStats(); |
| 473 #endif | 475 #endif |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 case version_info::Channel::CANARY: | 1054 case version_info::Channel::CANARY: |
| 1053 return true; | 1055 return true; |
| 1054 case version_info::Channel::DEV: | 1056 case version_info::Channel::DEV: |
| 1055 case version_info::Channel::BETA: | 1057 case version_info::Channel::BETA: |
| 1056 case version_info::Channel::STABLE: | 1058 case version_info::Channel::STABLE: |
| 1057 default: | 1059 default: |
| 1058 // Don't enable instrumentation. | 1060 // Don't enable instrumentation. |
| 1059 return false; | 1061 return false; |
| 1060 } | 1062 } |
| 1061 } | 1063 } |
| OLD | NEW |