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