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

Side by Side Diff: chrome/browser/android/offline_pages/background_scheduler_bridge.cc

Issue 2420503002: [Offline Pages] Define separate watchdog timeout for concurrent bg loads (Closed)
Patch Set: Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/android/callback_android.h" 5 #include "base/android/callback_android.h"
6 #include "base/android/scoped_java_ref.h" 6 #include "base/android/scoped_java_ref.h"
7 #include "chrome/browser/android/offline_pages/background_scheduler_bridge.h" 7 #include "chrome/browser/android/offline_pages/background_scheduler_bridge.h"
8 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" 8 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
9 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" 9 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 Profile* profile = ProfileManager::GetLastUsedProfile(); 45 Profile* profile = ProfileManager::GetLastUsedProfile();
46 RequestCoordinator* coordinator = 46 RequestCoordinator* coordinator =
47 RequestCoordinatorFactory::GetInstance()-> 47 RequestCoordinatorFactory::GetInstance()->
48 GetForBrowserContext(profile); 48 GetForBrowserContext(profile);
49 DVLOG(2) << "resource_coordinator: " << coordinator; 49 DVLOG(2) << "resource_coordinator: " << coordinator;
50 DeviceConditions device_conditions( 50 DeviceConditions device_conditions(
51 j_power_connected, j_battery_percentage, 51 j_power_connected, j_battery_percentage,
52 static_cast<net::NetworkChangeNotifier::ConnectionType>( 52 static_cast<net::NetworkChangeNotifier::ConnectionType>(
53 j_net_connection_type)); 53 j_net_connection_type));
54 return coordinator->StartProcessing( 54 return coordinator->StartProcessing(
55 device_conditions, base::Bind(&ProcessingDoneCallback, j_callback_ref)); 55 true /* is_background_scheduled */, device_conditions,
Pete Williamson 2016/10/12 22:33:24 Let's not use a binary argument, they are hard to
dougarnett 2016/10/13 19:46:44 ok, trying enum internally instead and reverting p
56 base::Bind(&ProcessingDoneCallback, j_callback_ref));
56 } 57 }
57 58
58 void BackgroundSchedulerBridge::Schedule( 59 void BackgroundSchedulerBridge::Schedule(
59 const TriggerConditions& trigger_conditions) { 60 const TriggerConditions& trigger_conditions) {
60 JNIEnv* env = base::android::AttachCurrentThread(); 61 JNIEnv* env = base::android::AttachCurrentThread();
61 ScopedJavaLocalRef<jobject> j_conditions = 62 ScopedJavaLocalRef<jobject> j_conditions =
62 CreateTriggerConditions(env, trigger_conditions.require_power_connected, 63 CreateTriggerConditions(env, trigger_conditions.require_power_connected,
63 trigger_conditions.minimum_battery_percentage, 64 trigger_conditions.minimum_battery_percentage,
64 trigger_conditions.require_unmetered_network); 65 trigger_conditions.require_unmetered_network);
65 Java_BackgroundSchedulerBridge_schedule(env, j_conditions); 66 Java_BackgroundSchedulerBridge_schedule(env, j_conditions);
(...skipping 24 matching lines...) Expand all
90 env, require_power_connected, minimum_battery_percentage, 91 env, require_power_connected, minimum_battery_percentage,
91 require_unmetered_network); 92 require_unmetered_network);
92 } 93 }
93 94
94 bool RegisterBackgroundSchedulerBridge(JNIEnv* env) { 95 bool RegisterBackgroundSchedulerBridge(JNIEnv* env) {
95 return RegisterNativesImpl(env); 96 return RegisterNativesImpl(env);
96 } 97 }
97 98
98 } // namespace android 99 } // namespace android
99 } // namespace offline_pages 100 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698