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 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1114 BrowserThread::UI, | 1114 BrowserThread::UI, |
1115 FROM_HERE, | 1115 FROM_HERE, |
1116 base::Bind(&WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles), | 1116 base::Bind(&WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles), |
1117 base::TimeDelta::FromMinutes(1)); | 1117 base::TimeDelta::FromMinutes(1)); |
1118 #endif | 1118 #endif |
1119 } | 1119 } |
1120 | 1120 |
1121 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { | 1121 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { |
1122 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRunImpl"); | 1122 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRunImpl"); |
1123 SCOPED_UMA_HISTOGRAM_LONG_TIMER("Startup.PreMainMessageLoopRunImplLongTime"); | 1123 SCOPED_UMA_HISTOGRAM_LONG_TIMER("Startup.PreMainMessageLoopRunImplLongTime"); |
1124 const base::TimeTicks start_time_step1 = base::TimeTicks::Now(); | |
1124 // Android updates the metrics service dynamically depending on whether the | 1125 // Android updates the metrics service dynamically depending on whether the |
1125 // application is in the foreground or not. Do not start here. | 1126 // application is in the foreground or not. Do not start here. |
1126 #if !defined(OS_ANDROID) | 1127 #if !defined(OS_ANDROID) |
1127 // Now that the file thread has been started, start recording. | 1128 // Now that the file thread has been started, start recording. |
1128 StartMetricsRecording(); | 1129 StartMetricsRecording(); |
1129 #endif | 1130 #endif |
1130 | 1131 |
1131 if (!base::debug::BeingDebugged()) { | 1132 if (!base::debug::BeingDebugged()) { |
1132 // Create watchdog thread after creating all other threads because it will | 1133 // Create watchdog thread after creating all other threads because it will |
1133 // watch the other threads and they must be running. | 1134 // watch the other threads and they must be running. |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1286 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1287 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) |
1287 | 1288 |
1288 // Desktop construction occurs here, (required before profile creation). | 1289 // Desktop construction occurs here, (required before profile creation). |
1289 PreProfileInit(); | 1290 PreProfileInit(); |
1290 | 1291 |
1291 // Profile creation ---------------------------------------------------------- | 1292 // Profile creation ---------------------------------------------------------- |
1292 | 1293 |
1293 metrics::MetricsService::SetExecutionPhase( | 1294 metrics::MetricsService::SetExecutionPhase( |
1294 metrics::MetricsService::CREATE_PROFILE, | 1295 metrics::MetricsService::CREATE_PROFILE, |
1295 g_browser_process->local_state()); | 1296 g_browser_process->local_state()); |
1297 | |
1298 UMA_HISTOGRAM_TIMES("Startup.PreMainMessageLoopRunImplStep1Time", | |
1299 base::TimeTicks::Now() - start_time_step1); | |
1300 | |
1296 profile_ = CreatePrimaryProfile(parameters(), | 1301 profile_ = CreatePrimaryProfile(parameters(), |
Alexei Svitkine (slow)
2015/02/26 20:58:39
Add a comment that this function is covered by a h
rkaplow
2015/02/28 20:09:47
Done.
| |
1297 user_data_dir_, | 1302 user_data_dir_, |
1298 parsed_command_line()); | 1303 parsed_command_line()); |
1299 if (!profile_) | 1304 if (!profile_) |
1300 return content::RESULT_CODE_NORMAL_EXIT; | 1305 return content::RESULT_CODE_NORMAL_EXIT; |
1301 | 1306 |
1307 const base::TimeTicks start_time_step2 = base::TimeTicks::Now(); | |
1308 | |
1302 #if !defined(OS_ANDROID) | 1309 #if !defined(OS_ANDROID) |
1303 // The first run sentinel must be created after the process singleton was | 1310 // The first run sentinel must be created after the process singleton was |
1304 // grabbed and no early return paths were otherwise hit above. | 1311 // grabbed and no early return paths were otherwise hit above. |
1305 first_run::CreateSentinelIfNeeded(); | 1312 first_run::CreateSentinelIfNeeded(); |
1306 #endif // !defined(OS_ANDROID) | 1313 #endif // !defined(OS_ANDROID) |
1307 | 1314 |
1308 #if defined(ENABLE_BACKGROUND) | 1315 #if defined(ENABLE_BACKGROUND) |
1309 // Autoload any profiles which are running background apps. | 1316 // Autoload any profiles which are running background apps. |
1310 // TODO(rlp): Do this on a separate thread. See http://crbug.com/99075. | 1317 // TODO(rlp): Do this on a separate thread. See http://crbug.com/99075. |
1311 browser_process_->profile_manager()->AutoloadProfiles(); | 1318 browser_process_->profile_manager()->AutoloadProfiles(); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1539 #if defined(OS_CHROMEOS) | 1546 #if defined(OS_CHROMEOS) |
1540 // On ChromeOS multiple profiles doesn't apply, and will break if we load | 1547 // On ChromeOS multiple profiles doesn't apply, and will break if we load |
1541 // them this early as the cryptohome hasn't yet been mounted (which happens | 1548 // them this early as the cryptohome hasn't yet been mounted (which happens |
1542 // only once we log in. | 1549 // only once we log in. |
1543 std::vector<Profile*> last_opened_profiles; | 1550 std::vector<Profile*> last_opened_profiles; |
1544 #else | 1551 #else |
1545 std::vector<Profile*> last_opened_profiles = | 1552 std::vector<Profile*> last_opened_profiles = |
1546 g_browser_process->profile_manager()->GetLastOpenedProfiles(); | 1553 g_browser_process->profile_manager()->GetLastOpenedProfiles(); |
1547 #endif | 1554 #endif |
1548 | 1555 |
1549 if (browser_creator_->Start(parsed_command_line(), base::FilePath(), | 1556 UMA_HISTOGRAM_TIMES("Startup.PreMainMessageLoopRunImplStep2Time", |
1550 profile_, last_opened_profiles)) { | 1557 base::TimeTicks::Now() - start_time_step2); |
1558 | |
1559 bool started = browser_creator_->Start(parsed_command_line(), | |
Alexei Svitkine (slow)
2015/02/26 20:58:40
Ditto.
rkaplow
2015/02/28 20:09:47
Done.
| |
1560 base::FilePath(), | |
1561 profile_, | |
1562 last_opened_profiles); | |
1563 const base::TimeTicks start_time_step3 = base::TimeTicks::Now(); | |
1564 if (started) { | |
1551 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 1565 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
1552 // Initialize autoupdate timer. Timer callback costs basically nothing | 1566 // Initialize autoupdate timer. Timer callback costs basically nothing |
1553 // when browser is not in persistent mode, so it's OK to let it ride on | 1567 // when browser is not in persistent mode, so it's OK to let it ride on |
1554 // the main thread. This needs to be done here because we don't want | 1568 // the main thread. This needs to be done here because we don't want |
1555 // to start the timer when Chrome is run inside a test harness. | 1569 // to start the timer when Chrome is run inside a test harness. |
1556 browser_process_->StartAutoupdateTimer(); | 1570 browser_process_->StartAutoupdateTimer(); |
1557 #endif | 1571 #endif |
1558 | 1572 |
1559 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1573 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
1560 // On Linux, the running exe will be updated if an upgrade becomes | 1574 // On Linux, the running exe will be updated if an upgrade becomes |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1619 run_message_loop_ = false; | 1633 run_message_loop_ = false; |
1620 } | 1634 } |
1621 #if defined(OS_ANDROID) | 1635 #if defined(OS_ANDROID) |
1622 // We never run the C++ main loop on Android, since the UI thread message | 1636 // We never run the C++ main loop on Android, since the UI thread message |
1623 // loop is controlled by the OS, so this is as close as we can get to | 1637 // loop is controlled by the OS, so this is as close as we can get to |
1624 // the start of the main loop | 1638 // the start of the main loop |
1625 if (result_code_ <= 0) { | 1639 if (result_code_ <= 0) { |
1626 RecordBrowserStartupTime(); | 1640 RecordBrowserStartupTime(); |
1627 } | 1641 } |
1628 #endif | 1642 #endif |
1643 | |
1644 UMA_HISTOGRAM_TIMES("Startup.PreMainMessageLoopRunImplStep3Time", | |
1645 base::TimeTicks::Now() - start_time_step3); | |
1646 | |
1629 return result_code_; | 1647 return result_code_; |
1630 } | 1648 } |
1631 | 1649 |
1632 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { | 1650 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { |
1633 TRACE_EVENT0("startup", "ChromeBrowserMainParts::MainMessageLoopRun"); | 1651 TRACE_EVENT0("startup", "ChromeBrowserMainParts::MainMessageLoopRun"); |
1634 #if defined(OS_ANDROID) | 1652 #if defined(OS_ANDROID) |
1635 // Chrome on Android does not use default MessageLoop. It has its own | 1653 // Chrome on Android does not use default MessageLoop. It has its own |
1636 // Android specific MessageLoop | 1654 // Android specific MessageLoop |
1637 NOTREACHED(); | 1655 NOTREACHED(); |
1638 return true; | 1656 return true; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1730 chromeos::CrosSettings::Shutdown(); | 1748 chromeos::CrosSettings::Shutdown(); |
1731 #endif | 1749 #endif |
1732 #endif | 1750 #endif |
1733 } | 1751 } |
1734 | 1752 |
1735 // Public members: | 1753 // Public members: |
1736 | 1754 |
1737 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1755 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
1738 chrome_extra_parts_.push_back(parts); | 1756 chrome_extra_parts_.push_back(parts); |
1739 } | 1757 } |
OLD | NEW |