| OLD | NEW |
| 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 Loading... |
| 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) |
| 690 // On Android the first run is handled in Java code, and the C++ side of |
| 691 // Chrome doesn't know if this is the first run. This will cause some |
| 692 // inaccuracy in the UMA statistics, but this should be minor (first runs are |
| 693 // rare). |
| 694 bool is_first_run = false; |
| 695 #else |
| 689 bool is_first_run = first_run::IsChromeFirstRun(); | 696 bool is_first_run = first_run::IsChromeFirstRun(); |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |