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 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 return true; | 1618 return true; |
1619 #else | 1619 #else |
1620 // Set the result code set in PreMainMessageLoopRun or set above. | 1620 // Set the result code set in PreMainMessageLoopRun or set above. |
1621 *result_code = result_code_; | 1621 *result_code = result_code_; |
1622 if (!run_message_loop_) | 1622 if (!run_message_loop_) |
1623 return true; // Don't run the default message loop. | 1623 return true; // Don't run the default message loop. |
1624 | 1624 |
1625 // These should be invoked as close to the start of the browser's | 1625 // These should be invoked as close to the start of the browser's |
1626 // UI thread message loop as possible to get a stable measurement | 1626 // UI thread message loop as possible to get a stable measurement |
1627 // across versions. | 1627 // across versions. |
1628 RecordBrowserStartupTime(); | 1628 RecordBrowserStartupTime(do_first_run_tasks_); |
1629 startup_timer_->SignalStartupComplete( | 1629 startup_timer_->SignalStartupComplete( |
1630 performance_monitor::StartupTimer::STARTUP_NORMAL); | 1630 performance_monitor::StartupTimer::STARTUP_NORMAL); |
1631 | 1631 |
1632 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 1632 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
1633 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) | 1633 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) |
1634 views::AcceleratorHandler accelerator_handler; | 1634 views::AcceleratorHandler accelerator_handler; |
1635 base::RunLoop run_loop(&accelerator_handler); | 1635 base::RunLoop run_loop(&accelerator_handler); |
1636 #else | 1636 #else |
1637 base::RunLoop run_loop; | 1637 base::RunLoop run_loop; |
1638 #endif | 1638 #endif |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1739 } | 1739 } |
1740 | 1740 |
1741 // Public members: | 1741 // Public members: |
1742 | 1742 |
1743 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1743 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
1744 chrome_extra_parts_.push_back(parts); | 1744 chrome_extra_parts_.push_back(parts); |
1745 } | 1745 } |
1746 | 1746 |
1747 // Misc ------------------------------------------------------------------------ | 1747 // Misc ------------------------------------------------------------------------ |
1748 | 1748 |
1749 void RecordBrowserStartupTime() { | 1749 void RecordBrowserStartupTime(bool is_first_run) { |
1750 // Don't record any metrics if UI was displayed before this point e.g. | 1750 // Don't record any metrics if UI was displayed before this point e.g. |
1751 // warning dialogs. | 1751 // warning dialogs. |
1752 if (startup_metric_utils::WasNonBrowserUIDisplayed()) | 1752 if (startup_metric_utils::WasNonBrowserUIDisplayed()) |
1753 return; | 1753 return; |
1754 | 1754 |
1755 // CurrentProcessInfo::CreationTime() is currently only implemented on Mac and | 1755 // CurrentProcessInfo::CreationTime() is currently only implemented on Mac and |
1756 // Windows. | 1756 // Windows. |
1757 #if defined(OS_MACOSX) || defined(OS_WIN) | 1757 #if defined(OS_MACOSX) || defined(OS_WIN) |
1758 const base::Time* process_creation_time = | 1758 const base::Time* process_creation_time = |
1759 base::CurrentProcessInfo::CreationTime(); | 1759 base::CurrentProcessInfo::CreationTime(); |
1760 | 1760 |
1761 if (process_creation_time) | 1761 if (!is_first_run && process_creation_time) { |
1762 RecordPreReadExperimentTime("Startup.BrowserMessageLoopStartTime", | 1762 RecordPreReadExperimentTime("Startup.BrowserMessageLoopStartTime", |
1763 base::Time::Now() - *process_creation_time); | 1763 base::Time::Now() - *process_creation_time); |
| 1764 } |
1764 #endif // defined(OS_MACOSX) || defined(OS_WIN) | 1765 #endif // defined(OS_MACOSX) || defined(OS_WIN) |
1765 | 1766 |
1766 // Record collected startup metrics. | 1767 // Record collected startup metrics. |
1767 startup_metric_utils::OnBrowserStartupComplete(); | 1768 startup_metric_utils::OnBrowserStartupComplete(is_first_run); |
1768 | 1769 |
1769 // Deletes self. | 1770 // Deletes self. |
1770 new LoadCompleteListener(); | 1771 new LoadCompleteListener(); |
1771 } | 1772 } |
1772 | 1773 |
1773 // This code is specific to the Windows-only PreReadExperiment field-trial. | 1774 // This code is specific to the Windows-only PreReadExperiment field-trial. |
1774 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time) { | 1775 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time) { |
1775 DCHECK(name != NULL); | 1776 DCHECK(name != NULL); |
1776 | 1777 |
1777 // This gets called with different histogram names, so we don't want to use | 1778 // This gets called with different histogram names, so we don't want to use |
(...skipping 17 matching lines...) Expand all Loading... |
1795 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1796 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1796 uma_name += "_XP"; | 1797 uma_name += "_XP"; |
1797 | 1798 |
1798 uma_name += "_PreRead_"; | 1799 uma_name += "_PreRead_"; |
1799 uma_name += pre_read_percentage; | 1800 uma_name += pre_read_percentage; |
1800 AddPreReadHistogramTime(uma_name.c_str(), time); | 1801 AddPreReadHistogramTime(uma_name.c_str(), time); |
1801 } | 1802 } |
1802 #endif | 1803 #endif |
1803 #endif | 1804 #endif |
1804 } | 1805 } |
OLD | NEW |