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

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 23443009: [Android] Support startup histogram. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [Android] Support startup histogram - move new android source and fix nits. Created 7 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/browser/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 #endif // defined(GOOGLE_CHROME_BUILD) 679 #endif // defined(GOOGLE_CHROME_BUILD)
680 return enabled; 680 return enabled;
681 } 681 }
682 682
683 void ChromeBrowserMainParts::RecordBrowserStartupTime() { 683 void ChromeBrowserMainParts::RecordBrowserStartupTime() {
684 // Don't record any metrics if UI was displayed before this point e.g. 684 // Don't record any metrics if UI was displayed before this point e.g.
685 // warning dialogs. 685 // warning dialogs.
686 if (startup_metric_utils::WasNonBrowserUIDisplayed()) 686 if (startup_metric_utils::WasNonBrowserUIDisplayed())
687 return; 687 return;
688 688
689 #if !defined(OS_ANDROID)
jam 2013/08/29 15:16:17 ditto
aberent 2013/08/29 16:19:44 Done.
689 bool is_first_run = first_run::IsChromeFirstRun(); 690 bool is_first_run = first_run::IsChromeFirstRun();
691 #else
692 // On Android the first run is handled very differently, and the C++ side of
693 // Chrome doesn't know if this is the first run. This will cause some
694 // inaccuracy in the UMA statistics, but this should be minor (first runs are
695 // rare).
696 bool is_first_run = false;
697 #endif
690 698
691 // CurrentProcessInfo::CreationTime() is currently only implemented on some 699 // CurrentProcessInfo::CreationTime() is currently only implemented on some
692 // platforms. 700 // platforms.
693 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) 701 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX)
694 const base::Time process_creation_time = 702 const base::Time process_creation_time =
695 base::CurrentProcessInfo::CreationTime(); 703 base::CurrentProcessInfo::CreationTime();
696 704
697 if (!is_first_run && !process_creation_time.is_null()) { 705 if (!is_first_run && !process_creation_time.is_null()) {
698 RecordPreReadExperimentTime("Startup.BrowserMessageLoopStartTime", 706 RecordPreReadExperimentTime("Startup.BrowserMessageLoopStartTime",
699 base::Time::Now() - process_creation_time); 707 base::Time::Now() - process_creation_time);
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 1596
1589 if (parameters().ui_task) { 1597 if (parameters().ui_task) {
1590 // We end the startup timer here if we have parameters to run, because we 1598 // We end the startup timer here if we have parameters to run, because we
1591 // never start to run the main loop (where we normally stop the timer). 1599 // never start to run the main loop (where we normally stop the timer).
1592 startup_timer_->SignalStartupComplete( 1600 startup_timer_->SignalStartupComplete(
1593 performance_monitor::StartupTimer::STARTUP_TEST); 1601 performance_monitor::StartupTimer::STARTUP_TEST);
1594 parameters().ui_task->Run(); 1602 parameters().ui_task->Run();
1595 delete parameters().ui_task; 1603 delete parameters().ui_task;
1596 run_message_loop_ = false; 1604 run_message_loop_ = false;
1597 } 1605 }
1598 1606 #if defined(OS_ANDROID)
1607 // We never run the C++ main loop on Android, since the UI thread message
1608 // loop is controlled by the OS, so this is as close as we can get to
1609 // the start of the main loop
1610 if (result_code_ <= 0) {
1611 RecordBrowserStartupTime();
1612 }
1613 #endif
1599 return result_code_; 1614 return result_code_;
1600 } 1615 }
1601 1616
1602 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { 1617 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) {
1603 TRACE_EVENT0("startup", "ChromeBrowserMainParts::MainMessageLoopRun"); 1618 TRACE_EVENT0("startup", "ChromeBrowserMainParts::MainMessageLoopRun");
1604 #if defined(OS_ANDROID) 1619 #if defined(OS_ANDROID)
1605 // Chrome on Android does not use default MessageLoop. It has its own 1620 // Chrome on Android does not use default MessageLoop. It has its own
1606 // Android specific MessageLoop 1621 // Android specific MessageLoop
1607 NOTREACHED(); 1622 NOTREACHED();
1608 return true; 1623 return true;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 chromeos::CrosSettings::Shutdown(); 1715 chromeos::CrosSettings::Shutdown();
1701 #endif 1716 #endif
1702 #endif 1717 #endif
1703 } 1718 }
1704 1719
1705 // Public members: 1720 // Public members:
1706 1721
1707 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1722 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1708 chrome_extra_parts_.push_back(parts); 1723 chrome_extra_parts_.push_back(parts);
1709 } 1724 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698