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

Side by Side Diff: chrome/browser/android/warmup_manager.cc

Issue 2929113002: Enable spare RenderProcessHost to be preinitialized. (Closed)
Patch Set: Change creation of storage partition to not break unittests with subtle threading issues Created 3 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/android/chrome_feature_list.cc ('k') | chrome/browser/flag_descriptions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/android/warmup_manager.h" 5 #include "chrome/browser/android/warmup_manager.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "chrome/browser/net/predictor.h" 9 #include "chrome/browser/net/predictor.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_android.h" 11 #include "chrome/browser/profiles/profile_android.h"
12 #include "content/public/browser/render_process_host.h"
12 #include "jni/WarmupManager_jni.h" 13 #include "jni/WarmupManager_jni.h"
13 #include "url/gurl.h" 14 #include "url/gurl.h"
14 15
15 using base::android::JavaParamRef; 16 using base::android::JavaParamRef;
16 17
17 static void PreconnectUrlAndSubresources(JNIEnv* env, 18 static void PreconnectUrlAndSubresources(JNIEnv* env,
18 const JavaParamRef<jclass>& clazz, 19 const JavaParamRef<jclass>& clazz,
19 const JavaParamRef<jobject>& jprofile, 20 const JavaParamRef<jobject>& jprofile,
20 const JavaParamRef<jstring>& url_str) { 21 const JavaParamRef<jstring>& url_str) {
21 if (url_str) { 22 if (url_str) {
22 GURL url = GURL(base::android::ConvertJavaStringToUTF8(env, url_str)); 23 GURL url = GURL(base::android::ConvertJavaStringToUTF8(env, url_str));
23 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); 24 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile);
24 if (profile) { 25 if (profile) {
25 profile->GetNetworkPredictor()->PreconnectUrlAndSubresources(url, GURL()); 26 profile->GetNetworkPredictor()->PreconnectUrlAndSubresources(url, GURL());
26 } 27 }
27 } 28 }
28 } 29 }
29 30
31 static void WarmupSpareRenderer(JNIEnv* env,
32 const JavaParamRef<jclass>& clazz,
33 const JavaParamRef<jobject>& jprofile) {
34 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile);
35 if (profile) {
36 content::RenderProcessHost::WarmupSpareRenderProcessHost(profile);
37 }
38 }
30 39
31 // Register native methods. 40 // Register native methods.
32 bool RegisterWarmupManager(JNIEnv* env) { 41 bool RegisterWarmupManager(JNIEnv* env) {
33 return RegisterNativesImpl(env); 42 return RegisterNativesImpl(env);
34 } 43 }
OLDNEW
« no previous file with comments | « chrome/browser/android/chrome_feature_list.cc ('k') | chrome/browser/flag_descriptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698