Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: chrome/app/chrome_main_delegate.cc

Issue 2345933002: Break chrome_initial's dependence on //components/startup_metric_utils/browser:lib (Closed)
Patch Set: more fixes Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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) {
fdoray 2016/09/19 17:03:28 base::TimeTicks
grt (UTC plus 2) 2016/09/19 19:52:46 Done.
438 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) 438 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX)
439 if (exe_entry_point_ticks) {
440 startup_metric_utils::RecordExeMainEntryPointTicks(
441 base::TimeTicks::FromInternalValue(exe_entry_point_ticks));
442 }
439 // Record the startup process creation time on supported platforms. 443 // Record the startup process creation time on supported platforms.
440 startup_metric_utils::RecordStartupProcessCreationTime( 444 startup_metric_utils::RecordStartupProcessCreationTime(
441 base::CurrentProcessInfo::CreationTime()); 445 base::CurrentProcessInfo::CreationTime());
442 #endif 446 #endif
443 447
444 // On Android the main entry point time is the time when the Java code starts. 448 // 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. 449 // 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 450 // 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 451 // from the Java side until it has initialized the JNI. See
448 // ChromeMainDelegateAndroid. 452 // ChromeMainDelegateAndroid.
449 #if !defined(OS_ANDROID) 453 #if !defined(OS_ANDROID)
450 startup_metric_utils::RecordMainEntryPointTime(base::Time::Now()); 454 startup_metric_utils::RecordMainEntryPointTime(base::Time::Now());
451 #endif 455 #endif
452 } 456 }
453 #endif // !defined(CHROME_MULTIPLE_DLL_CHILD) 457 #endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
454 458
455 } // namespace 459 } // namespace
456 460
457 ChromeMainDelegate::ChromeMainDelegate() { 461 ChromeMainDelegate::ChromeMainDelegate() : ChromeMainDelegate(0) {}
brucedawson 2016/09/16 21:38:39 I hadn't realized that delegating constructors wer
grt (UTC plus 2) 2016/09/17 09:30:05 Default values for args are somewhat discouraged b
462
463 ChromeMainDelegate::ChromeMainDelegate(int64_t exe_entry_point_ticks) {
458 #if !defined(CHROME_MULTIPLE_DLL_CHILD) 464 #if !defined(CHROME_MULTIPLE_DLL_CHILD)
459 // Record startup metrics in the browser process. For component builds, there 465 // 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 466 // 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. 467 // initialized), so the function below will also be called in renderers.
462 // This doesn't matter as it simply sets global variables. 468 // This doesn't matter as it simply sets global variables.
463 RecordMainStartupMetrics(); 469 RecordMainStartupMetrics(exe_entry_point_ticks);
464 #endif // !defined(CHROME_MULTIPLE_DLL_CHILD) 470 #endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
465 } 471 }
466 472
467 ChromeMainDelegate::~ChromeMainDelegate() { 473 ChromeMainDelegate::~ChromeMainDelegate() {
468 } 474 }
469 475
470 bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) { 476 bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) {
471 #if defined(OS_CHROMEOS) 477 #if defined(OS_CHROMEOS)
472 chromeos::BootTimesRecorder::Get()->SaveChromeMainStats(); 478 chromeos::BootTimesRecorder::Get()->SaveChromeMainStats();
473 #endif 479 #endif
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 case version_info::Channel::CANARY: 1058 case version_info::Channel::CANARY:
1053 return true; 1059 return true;
1054 case version_info::Channel::DEV: 1060 case version_info::Channel::DEV:
1055 case version_info::Channel::BETA: 1061 case version_info::Channel::BETA:
1056 case version_info::Channel::STABLE: 1062 case version_info::Channel::STABLE:
1057 default: 1063 default:
1058 // Don't enable instrumentation. 1064 // Don't enable instrumentation.
1059 return false; 1065 return false;
1060 } 1066 }
1061 } 1067 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698