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

Unified Diff: chrome/browser/android/offline_pages/background_scheduler_bridge.cc

Issue 2054913002: hook up background task's "startProcessing" from Java to request_coordinator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR feedback per DougArnett Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/background_scheduler_bridge.cc
diff --git a/chrome/browser/android/offline_pages/background_scheduler_bridge.cc b/chrome/browser/android/offline_pages/background_scheduler_bridge.cc
index 3075cb2ab30c79e13a67a6aad0383c60a64c8ca4..5b8fcbafbd9bf8aeddea80620b92ea78d6e12886 100644
--- a/chrome/browser/android/offline_pages/background_scheduler_bridge.cc
+++ b/chrome/browser/android/offline_pages/background_scheduler_bridge.cc
@@ -8,7 +8,7 @@
#include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
#include "chrome/browser/android/offline_pages/request_coordinator_factory.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/profiles/profile_android.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "components/offline_pages/background/request_coordinator.h"
#include "jni/BackgroundSchedulerBridge_jni.h"
@@ -21,7 +21,7 @@ namespace {
// C++ callback that delegates to Java callback.
void ProcessingDoneCallback(
- const ScopedJavaGlobalRef<jobject>& j_callback_obj, jboolean result) {
+ const ScopedJavaGlobalRef<jobject>& j_callback_obj, bool result) {
base::android::RunCallbackAndroid(j_callback_obj, result);
}
@@ -34,6 +34,18 @@ static jboolean StartProcessing(
const JavaParamRef<jobject>& j_callback_obj) {
ScopedJavaGlobalRef<jobject> j_callback_ref;
j_callback_ref.Reset(env, j_callback_obj);
+
+ // Lookup/create RequestCoordinator KeyedService and call StartProcessing on
+ // it with bound j_callback_obj.
+ Profile* profile = ProfileManager::GetLastUsedProfile();
+ RequestCoordinator* coordinator =
+ RequestCoordinatorFactory::GetInstance()->
+ GetForBrowserContext(profile);
+ DVLOG(2) << "resource_coordinator: " << coordinator;
+ coordinator->StartProcessing(
+ base::Bind(&ProcessingDoneCallback, j_callback_ref));
+
+
base::Bind(&ProcessingDoneCallback, j_callback_ref);
// TODO(dougarnett): lookup/create RequestCoordinator KeyedService
// and call StartProcessing on it with bound j_callback_obj.
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698