Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 949293002: Implement a poor man's PostAfterStartupTask() function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 21 matching lines...) Expand all
32 #include "base/strings/sys_string_conversions.h" 32 #include "base/strings/sys_string_conversions.h"
33 #include "base/strings/utf_string_conversions.h" 33 #include "base/strings/utf_string_conversions.h"
34 #include "base/sys_info.h" 34 #include "base/sys_info.h"
35 #include "base/threading/platform_thread.h" 35 #include "base/threading/platform_thread.h"
36 #include "base/time/time.h" 36 #include "base/time/time.h"
37 #include "base/trace_event/trace_event.h" 37 #include "base/trace_event/trace_event.h"
38 #include "base/values.h" 38 #include "base/values.h"
39 #include "build/build_config.h" 39 #include "build/build_config.h"
40 #include "cc/base/switches.h" 40 #include "cc/base/switches.h"
41 #include "chrome/browser/about_flags.h" 41 #include "chrome/browser/about_flags.h"
42 #include "chrome/browser/after_startup_task_utils.h"
42 #include "chrome/browser/browser_process.h" 43 #include "chrome/browser/browser_process.h"
43 #include "chrome/browser/browser_process_impl.h" 44 #include "chrome/browser/browser_process_impl.h"
44 #include "chrome/browser/browser_process_platform_part.h" 45 #include "chrome/browser/browser_process_platform_part.h"
45 #include "chrome/browser/browser_shutdown.h" 46 #include "chrome/browser/browser_shutdown.h"
46 #include "chrome/browser/chrome_browser_main_extra_parts.h" 47 #include "chrome/browser/chrome_browser_main_extra_parts.h"
47 #include "chrome/browser/component_updater/cld_component_installer.h" 48 #include "chrome/browser/component_updater/cld_component_installer.h"
48 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h" 49 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h"
49 #include "chrome/browser/component_updater/flash_component_installer.h" 50 #include "chrome/browser/component_updater/flash_component_installer.h"
50 #include "chrome/browser/component_updater/recovery_component_installer.h" 51 #include "chrome/browser/component_updater/recovery_component_installer.h"
51 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h " 52 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h "
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 #endif // !defined(OS_ANDROID) 1121 #endif // !defined(OS_ANDROID)
1121 #if defined(ENABLE_WEBRTC) 1122 #if defined(ENABLE_WEBRTC)
1122 // Set up a task to delete old WebRTC log files for all profiles. Use a delay 1123 // Set up a task to delete old WebRTC log files for all profiles. Use a delay
1123 // to reduce the impact on startup time. 1124 // to reduce the impact on startup time.
1124 BrowserThread::PostDelayedTask( 1125 BrowserThread::PostDelayedTask(
1125 BrowserThread::UI, 1126 BrowserThread::UI,
1126 FROM_HERE, 1127 FROM_HERE,
1127 base::Bind(&WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles), 1128 base::Bind(&WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles),
1128 base::TimeDelta::FromMinutes(1)); 1129 base::TimeDelta::FromMinutes(1));
1129 #endif // defined(ENABLE_WEBRTC) 1130 #endif // defined(ENABLE_WEBRTC)
1131
1132 // At this point, StartupBrowserCreator::Start has run creating initial
1133 // browser windows and tabs, but no progress has been made in loading
1134 // content as the main message loop hasn't started processing tasks yet.
1135 // We setup to observe to the initial page load here to defer running
1136 // task posted via PostAfterStartupTask until its complete.
1137 AfterStartupTaskUtils::StartMonitoringStartup();
1130 } 1138 }
1131 1139
1132 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { 1140 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
1133 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRunImpl"); 1141 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRunImpl");
1134 SCOPED_UMA_HISTOGRAM_LONG_TIMER("Startup.PreMainMessageLoopRunImplLongTime"); 1142 SCOPED_UMA_HISTOGRAM_LONG_TIMER("Startup.PreMainMessageLoopRunImplLongTime");
1135 const base::TimeTicks start_time_step1 = base::TimeTicks::Now(); 1143 const base::TimeTicks start_time_step1 = base::TimeTicks::Now();
1136 // Android updates the metrics service dynamically depending on whether the 1144 // Android updates the metrics service dynamically depending on whether the
1137 // application is in the foreground or not. Do not start here. 1145 // application is in the foreground or not. Do not start here.
1138 #if !defined(OS_ANDROID) 1146 #if !defined(OS_ANDROID)
1139 // Now that the file thread has been started, start recording. 1147 // Now that the file thread has been started, start recording.
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 chromeos::CrosSettings::Shutdown(); 1761 chromeos::CrosSettings::Shutdown();
1754 #endif // defined(OS_CHROMEOS) 1762 #endif // defined(OS_CHROMEOS)
1755 #endif // defined(OS_ANDROID) 1763 #endif // defined(OS_ANDROID)
1756 } 1764 }
1757 1765
1758 // Public members: 1766 // Public members:
1759 1767
1760 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1768 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1761 chrome_extra_parts_.push_back(parts); 1769 chrome_extra_parts_.push_back(parts);
1762 } 1770 }
OLDNEW
« no previous file with comments | « chrome/browser/after_startup_task_utils_unittest.cc ('k') | chrome/browser/chrome_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698