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

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java

Issue 2792873003: android: Post warmup to launcher thread (Closed)
Patch Set: rebase Created 3 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 package org.chromium.android_webview; 5 package org.chromium.android_webview;
6 6
7 import android.content.ComponentName; 7 import android.content.ComponentName;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.content.ServiceConnection; 10 import android.content.ServiceConnection;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 tryObtainingDataDirLock(appContext); 90 tryObtainingDataDirLock(appContext);
91 // We must post to the UI thread to cover the case that the user 91 // We must post to the UI thread to cover the case that the user
92 // has invoked Chromium startup by using the (thread-safe) 92 // has invoked Chromium startup by using the (thread-safe)
93 // CookieManager rather than creating a WebView. 93 // CookieManager rather than creating a WebView.
94 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 94 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
95 @Override 95 @Override
96 public void run() { 96 public void run() {
97 boolean multiProcess = CommandLine.getInstance().hasSwitch( 97 boolean multiProcess = CommandLine.getInstance().hasSwitch(
98 AwSwitches.WEBVIEW_SANDBOXED_RENDERER); 98 AwSwitches.WEBVIEW_SANDBOXED_RENDERER);
99 if (multiProcess) { 99 if (multiProcess) {
100 // Have a background thread warm up a renderer process now, so that this can 100 ChildProcessLauncher.warmUp(appContext);
101 // proceed in parallel to the browser process initialisation .
102 AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
103 @Override
104 public void run() {
105 ChildProcessLauncher.warmUp(appContext);
106 }
107 });
108 } 101 }
109 // The policies are used by browser startup, so we need to regis ter the policy 102 // The policies are used by browser startup, so we need to regis ter the policy
110 // providers before starting the browser process. This only regi sters java objects 103 // providers before starting the browser process. This only regi sters java objects
111 // and doesn't need the native library. 104 // and doesn't need the native library.
112 CombinedPolicyProvider.get().registerProvider(new AwPolicyProvid er(appContext)); 105 CombinedPolicyProvider.get().registerProvider(new AwPolicyProvid er(appContext));
113 106
114 // Check android settings but only when safebrowsing is enabled. 107 // Check android settings but only when safebrowsing is enabled.
115 AwSafeBrowsingConfigHelper.maybeInitSafeBrowsingFromSettings(app Context); 108 AwSafeBrowsingConfigHelper.maybeInitSafeBrowsingFromSettings(app Context);
116 109
117 try { 110 try {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 public void onServiceDisconnected(ComponentName className) { } 230 public void onServiceDisconnected(ComponentName className) { }
238 }; 231 };
239 if (!appContext.bindService(intent, connection, Context.BIND_AUT O_CREATE)) { 232 if (!appContext.bindService(intent, connection, Context.BIND_AUT O_CREATE)) {
240 Log.w(TAG, "Could not bind to Minidump-copying Service " + i ntent); 233 Log.w(TAG, "Could not bind to Minidump-copying Service " + i ntent);
241 } 234 }
242 return null; 235 return null;
243 } 236 }
244 }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); 237 }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
245 } 238 }
246 } 239 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698