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

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: Requested changes added Created 8 years, 5 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 6369faf66a410fc7b55ad7b9f1db27668680fbc2..54cf77578bef3dc5ab76a7bcf38ae9874b9a25ec 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -63,6 +63,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"
@@ -568,6 +569,7 @@ ChromeBrowserMainParts::ChromeBrowserMainParts(
result_code_(content::RESULT_CODE_NORMAL_EXIT),
startup_watcher_(new StartupTimeBomb()),
shutdown_watcher_(new ShutdownWatcherHelper()),
+ startup_timer_(new performance_monitor::StartupTimer()),
record_search_engine_(false),
translate_manager_(NULL),
profile_(NULL),
@@ -1939,6 +1941,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;
@@ -1953,10 +1959,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