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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/WarmupManager.java

Issue 2929113002: Enable spare RenderProcessHost to be preinitialized. (Closed)
Patch Set: Add WarmupManager hook Created 3 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.content.Context; 8 import android.content.Context;
9 import android.os.AsyncTask; 9 import android.os.AsyncTask;
10 import android.os.StrictMode; 10 import android.os.StrictMode;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // Note that if two requests come for the same URL with two 242 // Note that if two requests come for the same URL with two
243 // different profiles, the last one will win. 243 // different profiles, the last one will win.
244 mPendingPreconnectWithProfile.put(url, profile); 244 mPendingPreconnectWithProfile.put(url, profile);
245 } else { 245 } else {
246 nativePreconnectUrlAndSubresources(profile, url); 246 nativePreconnectUrlAndSubresources(profile, url);
247 } 247 }
248 } 248 }
249 } 249 }
250 250
251 /** 251 /**
252 * Warms up a spare, empty renderer that may be used for subsequent navigati ons.
Benoit L 2017/06/15 22:17:11 Can this be named "RenderProcessHost"? That would
mattcary 2017/06/16 08:18:56 Done.
253 *
254 * The spare renderer will be used automatically in subsequent navigations. There is
255 * nothing further the WarmupManager needs to do to enable that use.
256 *
257 * This uses a different mechanism than createSpareWebContents, below, and i s subject
258 * to fewer restrictions.
259 *
260 * This must be called from the UI thread.
261 */
262 public void createSpareRenderer(Profile profile) {
263 ThreadUtils.assertOnUiThread();
264 nativeWarmupSpareRenderer(profile);
265 }
266
267 /**
252 * Creates and initializes a spare WebContents, to be used in a subsequent n avigation. 268 * Creates and initializes a spare WebContents, to be used in a subsequent n avigation.
253 * 269 *
254 * This creates a renderer that is suitable for any navigation. It can be pi cked up by any tab. 270 * This creates a renderer that is suitable for any navigation. It can be pi cked up by any tab.
255 * Can be called multiple times, and must be called from the UI thread. 271 * Can be called multiple times, and must be called from the UI thread.
256 * Note that this is a no-op on low-end devices. 272 * Note that this is a no-op on low-end devices.
257 */ 273 */
258 public void createSpareWebContents() { 274 public void createSpareWebContents() {
259 ThreadUtils.assertOnUiThread(); 275 ThreadUtils.assertOnUiThread();
260 if (mSpareWebContents != null || SysUtils.isLowEndDevice()) return; 276 if (mSpareWebContents != null || SysUtils.isLowEndDevice()) return;
261 mSpareWebContents = WebContentsFactory.createWebContentsWithWarmRenderer (false, false); 277 mSpareWebContents = WebContentsFactory.createWebContentsWithWarmRenderer (false, false);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 mSpareWebContents = null; 323 mSpareWebContents = null;
308 mObserver = null; 324 mObserver = null;
309 } 325 }
310 326
311 private static void recordWebContentsStatus(int status) { 327 private static void recordWebContentsStatus(int status) {
312 RecordHistogram.recordEnumeratedHistogram( 328 RecordHistogram.recordEnumeratedHistogram(
313 WEBCONTENTS_STATUS_HISTOGRAM, status, WEBCONTENTS_STATUS_COUNT); 329 WEBCONTENTS_STATUS_HISTOGRAM, status, WEBCONTENTS_STATUS_COUNT);
314 } 330 }
315 331
316 private static native void nativePreconnectUrlAndSubresources(Profile profil e, String url); 332 private static native void nativePreconnectUrlAndSubresources(Profile profil e, String url);
333 private static native void nativeWarmupSpareRenderer(Profile profile);
317 } 334 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/warmup_manager.cc » ('j') | content/browser/renderer_host/render_process_host_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698