Commit 7a0351e8 authored by Henrique Nakashima's avatar Henrique Nakashima Committed by Commit Bot

Reland "Use ProfileKey instead of Profile in JNI_PrefetchBackgroundTask."

This reverts commit b1e5f6ca.

Reason for revert: Relanding with fix for chromium.android/android-jumbo-rel
(crbug.com/966508)

Original change's description:
> Use ProfileKey instead of Profile in JNI_PrefetchBackgroundTask.
>
> Now that the task may run in Reduced Mode, there is not necessarily a
> Profile anymore.
>
> Bug: 933358
> Change-Id: I58d3d69e724ca058b676cc4ff0b2b7ef24c7792e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1625392
> Reviewed-by: Carlos Knippschild <carlosk@chromium.org>
> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#662650}

Change-Id: I8661080a1d70a252bb462b5cc8e023e0c75e8b51
Bug: 933358
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1627635Reviewed-by: default avatarCarlos Knippschild <carlosk@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662867}
parent 616391e5
...@@ -8,10 +8,9 @@ ...@@ -8,10 +8,9 @@
#include "base/android/jni_string.h" #include "base/android/jni_string.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/browser/android/profile_key_util.h"
#include "chrome/browser/offline_pages/prefetch/prefetch_service_factory.h" #include "chrome/browser/offline_pages/prefetch/prefetch_service_factory.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_key.h"
#include "chrome/browser/profiles/profile_android.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "components/offline_pages/core/prefetch/prefetch_background_task.h" #include "components/offline_pages/core/prefetch/prefetch_background_task.h"
#include "components/offline_pages/core/prefetch/prefetch_dispatcher.h" #include "components/offline_pages/core/prefetch/prefetch_dispatcher.h"
#include "components/offline_pages/core/prefetch/prefetch_service.h" #include "components/offline_pages/core/prefetch/prefetch_service.h"
...@@ -30,11 +29,11 @@ static jboolean JNI_PrefetchBackgroundTask_StartPrefetchTask( ...@@ -30,11 +29,11 @@ static jboolean JNI_PrefetchBackgroundTask_StartPrefetchTask(
JNIEnv* env, JNIEnv* env,
const JavaParamRef<jobject>& jcaller, const JavaParamRef<jobject>& jcaller,
const JavaParamRef<jstring>& gcm_token) { const JavaParamRef<jstring>& gcm_token) {
Profile* profile = ProfileManager::GetLastUsedProfile(); ProfileKey* profile_key = ::android::GetMainProfileKey();
DCHECK(profile); DCHECK(profile_key);
PrefetchService* prefetch_service = PrefetchService* prefetch_service =
PrefetchServiceFactory::GetForKey(profile->GetProfileKey()); PrefetchServiceFactory::GetForKey(profile_key);
if (!prefetch_service) if (!prefetch_service)
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment