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

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 9150016: Move creation and ownership of ResourceDispatcherHost and PluginService to content. This gives a ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_browser_main.cc
===================================================================
--- chrome/browser/chrome_browser_main.cc (revision 116798)
+++ chrome/browser/chrome_browser_main.cc (working copy)
@@ -1156,6 +1156,8 @@
tracked_objects::ThreadData::InitializeAndSetTrackingStatus(enabled);
}
+ browser_process_->PreCreateThreads();
+
// This forces the TabCloseableStateWatcher to be created and, on chromeos,
// register for the notifications it needs to track the closeable state of
// tabs.
@@ -1312,38 +1314,6 @@
return content::RESULT_CODE_NORMAL_EXIT;
}
-void ChromeBrowserMainParts::PreStartThread(
- content::BrowserThread::ID thread_id) {
- browser_process_->PreStartThread(thread_id);
-}
-
-void ChromeBrowserMainParts::PostStartThread(
- content::BrowserThread::ID thread_id) {
- browser_process_->PostStartThread(thread_id);
- switch (thread_id) {
- case BrowserThread::FILE:
- // Now the command line has been mutated based on about:flags,
- // and the file thread has been started, we can set up metrics
- // and initialize field trials.
- metrics_ = SetupMetricsAndFieldTrials(local_state_);
-
-#if defined(USE_LINUX_BREAKPAD)
- // Needs to be called after we have chrome::DIR_USER_DATA and
- // g_browser_process. This happens in PreCreateThreads.
- BrowserThread::PostTask(BrowserThread::FILE,
- FROM_HERE,
- base::Bind(&GetLinuxDistroCallback));
-
- if (IsCrashReportingEnabled(local_state_))
- InitCrashReporter();
-#endif
- break;
-
- default:
- break;
- }
-}
-
void ChromeBrowserMainParts::PreMainMessageLoopRun() {
result_code_ = PreMainMessageLoopRunImpl();
@@ -1383,6 +1353,22 @@
}
int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
+ // Now the command line has been mutated based on about:flags,
+ // and the file thread has been started, we can set up metrics
+ // and initialize field trials.
+ metrics_ = SetupMetricsAndFieldTrials(local_state_);
+
+#if defined(USE_LINUX_BREAKPAD)
+ // Needs to be called after we have chrome::DIR_USER_DATA and
+ // g_browser_process. This happens in PreCreateThreads.
+ BrowserThread::PostTask(BrowserThread::FILE,
+ FROM_HERE,
+ base::Bind(&GetLinuxDistroCallback));
+
+ if (IsCrashReportingEnabled(local_state_))
+ InitCrashReporter();
+#endif
+
// Create watchdog thread after creating all other threads because it will
// watch the other threads and they must be running.
browser_process_->watchdog_thread();
@@ -1394,7 +1380,7 @@
#if defined(USE_WEBKIT_COMPOSITOR)
// We need to ensure WebKit has been initialized before we start the WebKit
// compositor. This is done by the ResourceDispatcherHost on creation.
- browser_process_->resource_dispatcher_host();
+ ResourceDispatcherHost::Get();
#endif
// Record last shutdown time into a histogram.
@@ -1928,15 +1914,8 @@
browser_process_->StartTearDown();
}
-void ChromeBrowserMainParts::PreStopThread(BrowserThread::ID identifier) {
- browser_process_->PreStopThread(identifier);
-}
-
-void ChromeBrowserMainParts::PostStopThread(BrowserThread::ID identifier) {
- browser_process_->PostStopThread(identifier);
-}
-
void ChromeBrowserMainParts::PostDestroyThreads() {
+ browser_process_->PostDestroyThreads();
// browser_shutdown takes care of deleting browser_process, so we need to
// release it.
ignore_result(browser_process_.release());

Powered by Google App Engine
This is Rietveld 408576698