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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_impl.cc

Issue 10834015: Add Startup Timing to CPM (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sky's finds + updates Created 8 years, 4 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/browser/ui/startup/startup_browser_creator_impl.h" 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 11 matching lines...) Expand all
22 #include "chrome/browser/browser_process.h" 22 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 23 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
24 #include "chrome/browser/defaults.h" 24 #include "chrome/browser/defaults.h"
25 #include "chrome/browser/extensions/extension_creator.h" 25 #include "chrome/browser/extensions/extension_creator.h"
26 #include "chrome/browser/extensions/extension_service.h" 26 #include "chrome/browser/extensions/extension_service.h"
27 #include "chrome/browser/extensions/pack_extension_job.h" 27 #include "chrome/browser/extensions/pack_extension_job.h"
28 #include "chrome/browser/first_run/first_run.h" 28 #include "chrome/browser/first_run/first_run.h"
29 #include "chrome/browser/net/predictor.h" 29 #include "chrome/browser/net/predictor.h"
30 #include "chrome/browser/net/url_fixer_upper.h" 30 #include "chrome/browser/net/url_fixer_upper.h"
31 #include "chrome/browser/notifications/desktop_notification_service.h" 31 #include "chrome/browser/notifications/desktop_notification_service.h"
32 #include "chrome/browser/performance_monitor/startup_timer.h"
32 #include "chrome/browser/prefs/incognito_mode_prefs.h" 33 #include "chrome/browser/prefs/incognito_mode_prefs.h"
33 #include "chrome/browser/prefs/pref_service.h" 34 #include "chrome/browser/prefs/pref_service.h"
34 #include "chrome/browser/prefs/session_startup_pref.h" 35 #include "chrome/browser/prefs/session_startup_pref.h"
35 #include "chrome/browser/profiles/profile.h" 36 #include "chrome/browser/profiles/profile.h"
36 #include "chrome/browser/profiles/profile_io_data.h" 37 #include "chrome/browser/profiles/profile_io_data.h"
37 #include "chrome/browser/protector/protected_prefs_watcher.h" 38 #include "chrome/browser/protector/protected_prefs_watcher.h"
38 #include "chrome/browser/protector/protector_service.h" 39 #include "chrome/browser/protector/protector_service.h"
39 #include "chrome/browser/protector/protector_service_factory.h" 40 #include "chrome/browser/protector/protector_service_factory.h"
40 #include "chrome/browser/protector/protector_utils.h" 41 #include "chrome/browser/protector/protector_utils.h"
41 #include "chrome/browser/sessions/session_restore.h" 42 #include "chrome/browser/sessions/session_restore.h"
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 if (!profile_->DidLastSessionExitCleanly() && 600 if (!profile_->DidLastSessionExitCleanly() &&
600 !command_line_.HasSwitch(switches::kRestoreLastSession)) { 601 !command_line_.HasSwitch(switches::kRestoreLastSession)) {
601 // The last session crashed. It's possible automatically loading the 602 // The last session crashed. It's possible automatically loading the
602 // page will trigger another crash, locking the user out of chrome. 603 // page will trigger another crash, locking the user out of chrome.
603 // To avoid this, don't restore on startup but instead show the crashed 604 // To avoid this, don't restore on startup but instead show the crashed
604 // infobar. 605 // infobar.
605 VLOG(1) << "Unclean exit; not processing"; 606 VLOG(1) << "Unclean exit; not processing";
606 return false; 607 return false;
607 } 608 }
608 609
609 uint32 restore_behavior = SessionRestore::SYNCHRONOUS | 610 uint32 restore_behavior = SessionRestore::SYNCHRONOUS |
610 SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; 611 SessionRestore::ALWAYS_CREATE_TABBED_BROWSER;
611 #if defined(OS_MACOSX) 612 #if defined(OS_MACOSX)
612 // On Mac, when restoring a session with no windows, suppress the creation 613 // On Mac, when restoring a session with no windows, suppress the creation
613 // of a new window in the case where the system is launching Chrome via a 614 // of a new window in the case where the system is launching Chrome via a
614 // login item or Lion's resume feature. 615 // login item or Lion's resume feature.
615 if (base::mac::WasLaunchedAsLoginOrResumeItem()) { 616 if (base::mac::WasLaunchedAsLoginOrResumeItem()) {
616 restore_behavior = restore_behavior & 617 restore_behavior = restore_behavior &
617 ~SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; 618 ~SessionRestore::ALWAYS_CREATE_TABBED_BROWSER;
618 } 619 }
619 #endif 620 #endif
620 621
622 // Pause the StartupTimer. Since the restore here is synchronous, we can
623 // keep these two metrics (browser startup time and session restore time)
624 // separate.
625 performance_monitor::StartupTimer::PauseTimer();
626
621 Browser* browser = SessionRestore::RestoreSession(profile_, 627 Browser* browser = SessionRestore::RestoreSession(profile_,
622 NULL, 628 NULL,
623 restore_behavior, 629 restore_behavior,
624 urls_to_open); 630 urls_to_open);
631
632 performance_monitor::StartupTimer::UnpauseTimer();
633
625 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); 634 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP);
626 return true; 635 return true;
627 } 636 }
628 637
629 Browser* browser = ProcessSpecifiedURLs(urls_to_open); 638 Browser* browser = ProcessSpecifiedURLs(urls_to_open);
630 if (!browser) 639 if (!browser)
631 return false; 640 return false;
632 641
633 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); 642 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP);
634 643
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 // New: 933 // New:
925 prefs->GetString(prefs::kHomePage), 934 prefs->GetString(prefs::kHomePage),
926 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), 935 prefs->GetBoolean(prefs::kHomePageIsNewTabPage),
927 prefs->GetBoolean(prefs::kShowHomeButton), 936 prefs->GetBoolean(prefs::kShowHomeButton),
928 // Backup: 937 // Backup:
929 backup_homepage, 938 backup_homepage,
930 backup_homepage_is_ntp, 939 backup_homepage_is_ntp,
931 backup_show_home_button)); 940 backup_show_home_button));
932 } 941 }
933 } 942 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698