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

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; remove unnecessary change to AwShellApplication.java 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)
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++ doesn't
jeremy 2013/08/27 19:18:51 nit: C++ -> "C++ side of things"
aberent 2013/08/28 15:53:05 Done.
693 // know if this is the first run. This will cause some inaccuracy in the UMA
694 // statistics, but this should be minor (first runs are rare).
695 bool is_first_run = false;
696 #endif
690 697
691 // CurrentProcessInfo::CreationTime() is currently only implemented on some 698 // CurrentProcessInfo::CreationTime() is currently only implemented on some
692 // platforms. 699 // platforms.
693 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) 700 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX)
694 const base::Time process_creation_time = 701 const base::Time process_creation_time =
695 base::CurrentProcessInfo::CreationTime(); 702 base::CurrentProcessInfo::CreationTime();
696 703
697 if (!is_first_run && !process_creation_time.is_null()) { 704 if (!is_first_run && !process_creation_time.is_null()) {
698 RecordPreReadExperimentTime("Startup.BrowserMessageLoopStartTime", 705 RecordPreReadExperimentTime("Startup.BrowserMessageLoopStartTime",
699 base::Time::Now() - process_creation_time); 706 base::Time::Now() - process_creation_time);
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 1595
1589 if (parameters().ui_task) { 1596 if (parameters().ui_task) {
1590 // We end the startup timer here if we have parameters to run, because we 1597 // 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). 1598 // never start to run the main loop (where we normally stop the timer).
1592 startup_timer_->SignalStartupComplete( 1599 startup_timer_->SignalStartupComplete(
1593 performance_monitor::StartupTimer::STARTUP_TEST); 1600 performance_monitor::StartupTimer::STARTUP_TEST);
1594 parameters().ui_task->Run(); 1601 parameters().ui_task->Run();
1595 delete parameters().ui_task; 1602 delete parameters().ui_task;
1596 run_message_loop_ = false; 1603 run_message_loop_ = false;
1597 } 1604 }
1598 1605 #if defined(OS_ANDROID)
1606 // We never run the C++ main loop on Android, since the UI thread message
1607 // loop is controlled by the OS, so this is as close as we can get to
1608 // the start of the main loop
1609 if (result_code_ <= 0) {
1610 RecordBrowserStartupTime();
1611 }
1612 #endif
1599 return result_code_; 1613 return result_code_;
1600 } 1614 }
1601 1615
1602 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { 1616 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) {
1603 TRACE_EVENT0("startup", "ChromeBrowserMainParts::MainMessageLoopRun"); 1617 TRACE_EVENT0("startup", "ChromeBrowserMainParts::MainMessageLoopRun");
1604 #if defined(OS_ANDROID) 1618 #if defined(OS_ANDROID)
1605 // Chrome on Android does not use default MessageLoop. It has its own 1619 // Chrome on Android does not use default MessageLoop. It has its own
1606 // Android specific MessageLoop 1620 // Android specific MessageLoop
1607 NOTREACHED(); 1621 NOTREACHED();
1608 return true; 1622 return true;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 chromeos::CrosSettings::Shutdown(); 1714 chromeos::CrosSettings::Shutdown();
1701 #endif 1715 #endif
1702 #endif 1716 #endif
1703 } 1717 }
1704 1718
1705 // Public members: 1719 // Public members:
1706 1720
1707 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1721 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1708 chrome_extra_parts_.push_back(parts); 1722 chrome_extra_parts_.push_back(parts);
1709 } 1723 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698