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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1390 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
1391 chrome_extra_parts_[i]->PostBrowserStart(); | 1391 chrome_extra_parts_[i]->PostBrowserStart(); |
1392 #if !defined(OS_ANDROID) | 1392 #if !defined(OS_ANDROID) |
1393 // Allow ProcessSingleton to process messages. | 1393 // Allow ProcessSingleton to process messages. |
1394 process_singleton_->Unlock(); | 1394 process_singleton_->Unlock(); |
1395 #endif // !defined(OS_ANDROID) | 1395 #endif // !defined(OS_ANDROID) |
1396 #if BUILDFLAG(ENABLE_WEBRTC) | 1396 #if BUILDFLAG(ENABLE_WEBRTC) |
1397 // Set up a task to delete old WebRTC log files for all profiles. Use a delay | 1397 // Set up a task to delete old WebRTC log files for all profiles. Use a delay |
1398 // to reduce the impact on startup time. | 1398 // to reduce the impact on startup time. |
1399 BrowserThread::PostDelayedTask( | 1399 BrowserThread::PostDelayedTask( |
1400 BrowserThread::UI, | 1400 BrowserThread::UI, FROM_HERE, |
1401 FROM_HERE, | 1401 base::BindOnce(&WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles), |
1402 base::Bind(&WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles), | |
1403 base::TimeDelta::FromMinutes(1)); | 1402 base::TimeDelta::FromMinutes(1)); |
1404 #endif // BUILDFLAG(ENABLE_WEBRTC) | 1403 #endif // BUILDFLAG(ENABLE_WEBRTC) |
1405 | 1404 |
1406 #if !defined(OS_ANDROID) | 1405 #if !defined(OS_ANDROID) |
1407 if (base::FeatureList::IsEnabled(features::kWebUsb)) { | 1406 if (base::FeatureList::IsEnabled(features::kWebUsb)) { |
1408 web_usb_detector_.reset(new WebUsbDetector()); | 1407 web_usb_detector_.reset(new WebUsbDetector()); |
1409 BrowserThread::PostAfterStartupTask( | 1408 BrowserThread::PostAfterStartupTask( |
1410 FROM_HERE, BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), | 1409 FROM_HERE, BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
1411 base::Bind(&WebUsbDetector::Initialize, | 1410 base::BindOnce(&WebUsbDetector::Initialize, |
1412 base::Unretained(web_usb_detector_.get()))); | 1411 base::Unretained(web_usb_detector_.get()))); |
1413 } | 1412 } |
1414 #endif | 1413 #endif |
1415 | 1414 |
1416 // At this point, StartupBrowserCreator::Start has run creating initial | 1415 // At this point, StartupBrowserCreator::Start has run creating initial |
1417 // browser windows and tabs, but no progress has been made in loading | 1416 // browser windows and tabs, but no progress has been made in loading |
1418 // content as the main message loop hasn't started processing tasks yet. | 1417 // content as the main message loop hasn't started processing tasks yet. |
1419 // We setup to observe to the initial page load here to defer running | 1418 // We setup to observe to the initial page load here to defer running |
1420 // task posted via PostAfterStartupTask until its complete. | 1419 // task posted via PostAfterStartupTask until its complete. |
1421 AfterStartupTaskUtils::StartMonitoringStartup(); | 1420 AfterStartupTaskUtils::StartMonitoringStartup(); |
1422 } | 1421 } |
(...skipping 16 matching lines...) Expand all Loading... |
1439 // Windows parental controls calls can be slow, so we do an early init here | 1438 // Windows parental controls calls can be slow, so we do an early init here |
1440 // that calculates this value off of the UI thread. | 1439 // that calculates this value off of the UI thread. |
1441 IncognitoModePrefs::InitializePlatformParentalControls(); | 1440 IncognitoModePrefs::InitializePlatformParentalControls(); |
1442 #endif | 1441 #endif |
1443 | 1442 |
1444 #if BUILDFLAG(ENABLE_EXTENSIONS) | 1443 #if BUILDFLAG(ENABLE_EXTENSIONS) |
1445 if (!variations::GetVariationParamValue( | 1444 if (!variations::GetVariationParamValue( |
1446 "LightSpeed", "EarlyInitStartup").empty()) { | 1445 "LightSpeed", "EarlyInitStartup").empty()) { |
1447 // Try to compute this early on another thread so that we don't spend time | 1446 // Try to compute this early on another thread so that we don't spend time |
1448 // during profile load initializing the extensions APIs. | 1447 // during profile load initializing the extensions APIs. |
1449 BrowserThread::PostTask( | 1448 BrowserThread::PostTask(BrowserThread::FILE_USER_BLOCKING, FROM_HERE, |
1450 BrowserThread::FILE_USER_BLOCKING, | 1449 base::BindOnce(base::IgnoreResult( |
1451 FROM_HERE, | 1450 &extensions::FeatureProvider::GetAPIFeatures))); |
1452 base::Bind( | |
1453 base::IgnoreResult(&extensions::FeatureProvider::GetAPIFeatures))); | |
1454 } | 1451 } |
1455 #endif | 1452 #endif |
1456 | 1453 |
1457 // Android updates the metrics service dynamically depending on whether the | 1454 // Android updates the metrics service dynamically depending on whether the |
1458 // application is in the foreground or not. Do not start here. | 1455 // application is in the foreground or not. Do not start here. |
1459 #if !defined(OS_ANDROID) | 1456 #if !defined(OS_ANDROID) |
1460 // Now that the file thread has been started, start recording. | 1457 // Now that the file thread has been started, start recording. |
1461 StartMetricsRecording(); | 1458 StartMetricsRecording(); |
1462 #endif // !defined(OS_ANDROID) | 1459 #endif // !defined(OS_ANDROID) |
1463 | 1460 |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 // TODO(thestig): See if the Android code below can be moved to later. | 1802 // TODO(thestig): See if the Android code below can be moved to later. |
1806 sessions::ContentSerializedNavigationDriver::SetInstance( | 1803 sessions::ContentSerializedNavigationDriver::SetInstance( |
1807 ChromeSerializedNavigationDriver::GetInstance()); | 1804 ChromeSerializedNavigationDriver::GetInstance()); |
1808 | 1805 |
1809 #if defined(OS_ANDROID) | 1806 #if defined(OS_ANDROID) |
1810 ThreadWatcherAndroid::RegisterApplicationStatusListener(); | 1807 ThreadWatcherAndroid::RegisterApplicationStatusListener(); |
1811 offline_pages::OfflinePageInfoHandler::Register(); | 1808 offline_pages::OfflinePageInfoHandler::Register(); |
1812 #endif // defined(OS_ANDROID) | 1809 #endif // defined(OS_ANDROID) |
1813 | 1810 |
1814 #if !defined(DISABLE_NACL) | 1811 #if !defined(DISABLE_NACL) |
1815 BrowserThread::PostTask( | 1812 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
1816 BrowserThread::IO, | 1813 base::BindOnce(nacl::NaClProcessHost::EarlyStartup)); |
1817 FROM_HERE, | |
1818 base::Bind(nacl::NaClProcessHost::EarlyStartup)); | |
1819 #endif // !defined(DISABLE_NACL) | 1814 #endif // !defined(DISABLE_NACL) |
1820 | 1815 |
1821 // Make sure initial prefs are recorded | 1816 // Make sure initial prefs are recorded |
1822 PrefMetricsService::Factory::GetForProfile(profile_); | 1817 PrefMetricsService::Factory::GetForProfile(profile_); |
1823 | 1818 |
1824 PreBrowserStart(); | 1819 PreBrowserStart(); |
1825 | 1820 |
1826 // Instantiate the notification UI manager, as this triggers a perf timer | 1821 // Instantiate the notification UI manager, as this triggers a perf timer |
1827 // used to measure startup time. TODO(stevenjb): Figure out what is actually | 1822 // used to measure startup time. TODO(stevenjb): Figure out what is actually |
1828 // triggering the timer and call that explicitly in the approprate place. | 1823 // triggering the timer and call that explicitly in the approprate place. |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 chromeos::CrosSettings::Shutdown(); | 2076 chromeos::CrosSettings::Shutdown(); |
2082 #endif // defined(OS_CHROMEOS) | 2077 #endif // defined(OS_CHROMEOS) |
2083 #endif // defined(OS_ANDROID) | 2078 #endif // defined(OS_ANDROID) |
2084 } | 2079 } |
2085 | 2080 |
2086 // Public members: | 2081 // Public members: |
2087 | 2082 |
2088 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2083 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
2089 chrome_extra_parts_.push_back(parts); | 2084 chrome_extra_parts_.push_back(parts); |
2090 } | 2085 } |
OLD | NEW |