Chromium Code Reviews| Index: chrome/browser/android/precache/precache_launcher.cc |
| diff --git a/chrome/browser/android/precache/precache_launcher.cc b/chrome/browser/android/precache/precache_launcher.cc |
| index 6b89d59570afe2aa066f298253cebcb0f0b2711c..62be4d6d5eb9a93945839b577442666365cbd801 100644 |
| --- a/chrome/browser/android/precache/precache_launcher.cc |
| +++ b/chrome/browser/android/precache/precache_launcher.cc |
| @@ -65,10 +65,8 @@ void PrecacheLauncher::Start(JNIEnv* env, jobject obj) { |
| history::HistoryService* hs = HistoryServiceFactory::GetForProfile( |
|
bengr
2015/08/06 00:01:01
nit: No need to get the hs if precache_manager is
twifkak
2015/08/06 00:18:17
A future CL (not yet sent) moves the hs out of her
|
| profile, ServiceAccessType::IMPLICIT_ACCESS); |
| - if (precache_manager == nullptr || hs == nullptr || |
| - !precache_manager->IsPrecachingAllowed()) { |
| - Java_PrecacheLauncher_onPrecacheCompletedCallback( |
| - env, weak_java_precache_launcher_.get(env).obj()); |
| + if (precache_manager == nullptr || hs == nullptr) { |
| + OnPrecacheCompleted(); |
| return; |
| } |
| @@ -95,8 +93,11 @@ static jlong Init(JNIEnv* env, jobject obj) { |
| return reinterpret_cast<intptr_t>(new PrecacheLauncher(env, obj)); |
| } |
| -static jboolean IsPrecachingEnabled(JNIEnv* env, jclass clazz) { |
| - return PrecacheManager::IsPrecachingEnabled(); |
| +// Must be run on the UI thread. |
| +static jboolean ShouldRun(JNIEnv* env, jobject obj) { |
| + Profile* profile = GetProfile(); |
| + PrecacheManager* precache_manager = GetPrecacheManager(profile); |
| + return precache_manager && precache_manager->ShouldRun(); |
| } |
| bool RegisterPrecacheLauncher(JNIEnv* env) { |