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

Unified Diff: android_webview/lib/main/aw_main_delegate.cc

Issue 19957002: Run the later parts of startup as UI thread tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Run the later parts of startup as UI thread tasks - patch for Yaron's comments Created 7 years, 5 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: 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(

Powered by Google App Engine
This is Rietveld 408576698