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(base::TimeTicks exe_entry_point_ticks) { |
| 438 if (!exe_entry_point_ticks.is_null()) |
| 439 startup_metric_utils::RecordExeMainEntryPointTicks(exe_entry_point_ticks); |
438 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) | 440 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) |
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() |
| 460 : ChromeMainDelegate(base::TimeTicks()) {} |
| 461 |
| 462 ChromeMainDelegate::ChromeMainDelegate(base::TimeTicks exe_entry_point_ticks) { |
458 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | 463 #if !defined(CHROME_MULTIPLE_DLL_CHILD) |
459 // Record startup metrics in the browser process. For component builds, there | 464 // 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 | 465 // 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. | 466 // initialized), so the function below will also be called in renderers. |
462 // This doesn't matter as it simply sets global variables. | 467 // This doesn't matter as it simply sets global variables. |
463 RecordMainStartupMetrics(); | 468 RecordMainStartupMetrics(exe_entry_point_ticks); |
464 #endif // !defined(CHROME_MULTIPLE_DLL_CHILD) | 469 #endif // !defined(CHROME_MULTIPLE_DLL_CHILD) |
465 } | 470 } |
466 | 471 |
467 ChromeMainDelegate::~ChromeMainDelegate() { | 472 ChromeMainDelegate::~ChromeMainDelegate() { |
468 } | 473 } |
469 | 474 |
470 bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) { | 475 bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) { |
471 #if defined(OS_CHROMEOS) | 476 #if defined(OS_CHROMEOS) |
472 chromeos::BootTimesRecorder::Get()->SaveChromeMainStats(); | 477 chromeos::BootTimesRecorder::Get()->SaveChromeMainStats(); |
473 #endif | 478 #endif |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 case version_info::Channel::CANARY: | 1057 case version_info::Channel::CANARY: |
1053 return true; | 1058 return true; |
1054 case version_info::Channel::DEV: | 1059 case version_info::Channel::DEV: |
1055 case version_info::Channel::BETA: | 1060 case version_info::Channel::BETA: |
1056 case version_info::Channel::STABLE: | 1061 case version_info::Channel::STABLE: |
1057 default: | 1062 default: |
1058 // Don't enable instrumentation. | 1063 // Don't enable instrumentation. |
1059 return false; | 1064 return false; |
1060 } | 1065 } |
1061 } | 1066 } |
OLD | NEW |