Index: android_webview/lib/main/aw_main_delegate.cc |
diff --git a/android_webview/lib/main/aw_main_delegate.cc b/android_webview/lib/main/aw_main_delegate.cc |
index aeef23c75e22b80f8c3061cbd682abe4126e40bf..125dc64e1aa86e4f81a58fdb0ab722256332039f 100644 |
--- a/android_webview/lib/main/aw_main_delegate.cc |
+++ b/android_webview/lib/main/aw_main_delegate.cc |
@@ -20,6 +20,7 @@ |
#include "content/public/browser/browser_main_runner.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/common/content_switches.h" |
+#include "content/public/common/startup_task_runner.h" |
#include "gpu/command_buffer/client/gl_in_process_context.h" |
#include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" |
@@ -72,8 +73,18 @@ int AwMainDelegate::RunProcess( |
if (process_type.empty()) { |
AwBrowserDependencyFactoryImpl::InstallInstance(); |
+ // In Webview we must run all startup tasks immediately, since applications |
+ // may depend on startup being complete on return from this function (or, |
+ // to be precise, its callers from Java). |
+ scoped_refptr<content::StartupTaskRunner> startup_task_runner( |
+ new content::StartupTaskRunner(content::StartupTaskRunner::IMMEDIATE, |
+ GetStartupObserver())); |
+ |
browser_runner_.reset(content::BrowserMainRunner::Create()); |
- int exit_code = browser_runner_->Initialize(main_function_params); |
+ |
+ int exit_code = |
+ browser_runner_->Initialize(main_function_params, startup_task_runner); |
+ |
DCHECK(exit_code < 0); |
g_allow_wait_in_ui_thread.Get().reset( |