summaryrefslogtreecommitdiff
path: root/content/browser/browser_main_loop.cc
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-08-30 15:14:49 +0100
committerTorne (Richard Coles) <torne@google.com>2013-08-30 15:14:49 +0100
commit424c4d7b64af9d0d8fd9624f381f469654d5e3d2 (patch)
treeaf8b16dc2ba7fc8c8bb1c9fa18b907c847f3883d /content/browser/browser_main_loop.cc
parentc70ef2906f891fe7d218980660e4cda465717916 (diff)
downloadchromium_org-424c4d7b64af9d0d8fd9624f381f469654d5e3d2.tar.gz
Merge from Chromium at DEPS revision r220549
This commit was generated by merge_to_master.py. Change-Id: I8fcb82db764ec1eb0294280936c177bd9ba8a9e9
Diffstat (limited to 'content/browser/browser_main_loop.cc')
-rw-r--r--content/browser/browser_main_loop.cc64
1 files changed, 40 insertions, 24 deletions
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 8bf6503759..ee84e7cba6 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -420,6 +420,7 @@ void BrowserMainLoop::MainMessageLoopStart() {
network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
}
+#if !defined(OS_IOS)
{
TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:MediaFeatures")
media::InitializeCPUSpecificMediaFeatures();
@@ -432,8 +433,6 @@ void BrowserMainLoop::MainMessageLoopStart() {
TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:MIDIManager")
midi_manager_.reset(media::MIDIManager::Create());
}
-
-#if !defined(OS_IOS)
{
TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:ContentWebUIController")
WebUIControllerFactory::RegisterFactory(
@@ -527,36 +526,53 @@ int BrowserMainLoop::PreCreateThreads() {
}
void BrowserMainLoop::CreateStartupTasks() {
- TRACE_EVENT0("startup", "BrowserMainLoop::CreateStartupTasks")
+ TRACE_EVENT0("startup", "BrowserMainLoop::CreateStartupTasks");
+ // First time through, we really want to create all the tasks
+ if (!startup_task_runner_.get()) {
#if defined(OS_ANDROID)
- scoped_refptr<StartupTaskRunner> task_runner =
- new StartupTaskRunner(BrowserMayStartAsynchronously(),
- base::Bind(&BrowserStartupComplete),
- base::MessageLoop::current()->message_loop_proxy());
+ startup_task_runner_ = make_scoped_ptr(new StartupTaskRunner(
+ base::Bind(&BrowserStartupComplete),
+ base::MessageLoop::current()->message_loop_proxy()));
#else
- scoped_refptr<StartupTaskRunner> task_runner =
- new StartupTaskRunner(false,
- base::Callback<void(int)>(),
- base::MessageLoop::current()->message_loop_proxy());
+ startup_task_runner_ = make_scoped_ptr(new StartupTaskRunner(
+ base::Callback<void(int)>(),
+ base::MessageLoop::current()->message_loop_proxy()));
#endif
- StartupTask pre_create_threads =
- base::Bind(&BrowserMainLoop::PreCreateThreads, base::Unretained(this));
- task_runner->AddTask(pre_create_threads);
+ StartupTask pre_create_threads =
+ base::Bind(&BrowserMainLoop::PreCreateThreads, base::Unretained(this));
+ startup_task_runner_->AddTask(pre_create_threads);
- StartupTask create_threads =
- base::Bind(&BrowserMainLoop::CreateThreads, base::Unretained(this));
- task_runner->AddTask(create_threads);
+ StartupTask create_threads =
+ base::Bind(&BrowserMainLoop::CreateThreads, base::Unretained(this));
+ startup_task_runner_->AddTask(create_threads);
- StartupTask browser_thread_started = base::Bind(
- &BrowserMainLoop::BrowserThreadsStarted, base::Unretained(this));
- task_runner->AddTask(browser_thread_started);
+ StartupTask browser_thread_started = base::Bind(
+ &BrowserMainLoop::BrowserThreadsStarted, base::Unretained(this));
+ startup_task_runner_->AddTask(browser_thread_started);
- StartupTask pre_main_message_loop_run = base::Bind(
- &BrowserMainLoop::PreMainMessageLoopRun, base::Unretained(this));
- task_runner->AddTask(pre_main_message_loop_run);
+ StartupTask pre_main_message_loop_run = base::Bind(
+ &BrowserMainLoop::PreMainMessageLoopRun, base::Unretained(this));
+ startup_task_runner_->AddTask(pre_main_message_loop_run);
- task_runner->StartRunningTasks();
+#if defined(OS_ANDROID)
+ if (BrowserMayStartAsynchronously()) {
+ startup_task_runner_->StartRunningTasksAsync();
+ }
+#endif
+ }
+#if defined(OS_ANDROID)
+ if (!BrowserMayStartAsynchronously()) {
+ // A second request for asynchronous startup can be ignored, so
+ // StartupRunningTasksAsync is only called first time through. If, however,
+ // this is a request for synchronous startup then it must override any
+ // previous call for async startup, so we call RunAllTasksNow()
+ // unconditionally.
+ startup_task_runner_->RunAllTasksNow();
+ }
+#else
+ startup_task_runner_->RunAllTasksNow();
+#endif
}
int BrowserMainLoop::CreateThreads() {