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

Unified Diff: chrome/browser/chrome_browser_main.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 84a6a510644adb096528bc9aec9626c23a70a138..1bba47d1ca3425d02ccb6a1e3b8b991668cc1beb 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -56,6 +56,7 @@
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/notifications/desktop_notification_service_factory.h"
#include "chrome/browser/page_cycler/page_cycler.h"
+#include "chrome/browser/performance_monitor/startup_timer.h"
#include "chrome/browser/plugin_prefs.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/pref_value_store.h"
@@ -498,6 +499,7 @@ ChromeBrowserMainParts::ChromeBrowserMainParts(
result_code_(content::RESULT_CODE_NORMAL_EXIT),
startup_watcher_(new StartupTimeBomb()),
shutdown_watcher_(new ShutdownWatcherHelper()),
+ startup_timer_(new performance_monitor::StartupTimer()),
browser_field_trials_(parameters.command_line),
record_search_engine_(false),
translate_manager_(NULL),
@@ -1383,6 +1385,10 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
PostBrowserStart();
if (parameters().ui_task) {
+ // We end the startup timer here if we have parameters to run, because we
+ // never start to run the main loop (where we normally stop the timer).
+ startup_timer_->SignalStartupComplete(
+ performance_monitor::StartupTimer::STARTUP_TEST);
parameters().ui_task->Run();
delete parameters().ui_task;
run_message_loop_ = false;
@@ -1397,10 +1403,13 @@ bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) {
if (!run_message_loop_)
return true; // Don't run the default message loop.
- // This should be invoked as close to the start of the browser's
+ // These should be invoked as close to the start of the browser's
// UI thread message loop as possible to get a stable measurement
// across versions.
RecordBrowserStartupTime();
+ startup_timer_->SignalStartupComplete(
+ performance_monitor::StartupTimer::STARTUP_NORMAL);
+
DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type());
#if !defined(USE_AURA) && defined(TOOLKIT_VIEWS)
views::AcceleratorHandler accelerator_handler;

Powered by Google App Engine
This is Rietveld 408576698