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

Unified Diff: components/offline_pages/background/request_coordinator.cc

Issue 2425873003: [Offline Pages] Add evaluation test support in RequestCoordinator. (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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/background/request_coordinator.cc
diff --git a/components/offline_pages/background/request_coordinator.cc b/components/offline_pages/background/request_coordinator.cc
index 7d4eebf43335dea390dce6d08b7557d9ec4f0d03..55c7b6b4bad639be15f88cb8986a9bceefdcd937 100644
--- a/components/offline_pages/background/request_coordinator.cc
+++ b/components/offline_pages/background/request_coordinator.cc
@@ -136,6 +136,7 @@ RequestCoordinator::RequestCoordinator(
network_quality_estimator_(network_quality_estimator),
active_request_(nullptr),
last_offlining_status_(Offliner::RequestStatus::UNKNOWN),
+ user_request_callback_(base::Bind(&EmptySchedulerCallback)),
weak_ptr_factory_(this) {
DCHECK(policy_ != nullptr);
picker_.reset(
@@ -464,10 +465,10 @@ RequestCoordinator::TryImmediateStart() {
// Start processing with manufactured conservative battery conditions
// (i.e., assume no battery).
// TODO(dougarnett): Obtain actual battery conditions (from Android/Java).
+
DeviceConditions device_conditions(false, 0, GetConnectionType());
if (StartProcessingInternal(ProcessingWindowState::IMMEDIATE_WINDOW,
- device_conditions,
- base::Bind(&EmptySchedulerCallback)))
+ device_conditions, user_request_callback_))
dougarnett 2016/10/18 17:26:32 immediate_schedule_callback ?
Pete Williamson 2016/10/18 19:24:32 +1 to dougarnett's suggestion.
romax 2016/10/18 20:31:51 Done.
return OfflinerImmediateStartStatus::STARTED;
else
return OfflinerImmediateStartStatus::NOT_ACCEPTED;
@@ -646,6 +647,7 @@ void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request,
case Offliner::RequestStatus::PRERENDERING_CANCELED:
case Offliner::RequestStatus::PRERENDERING_FAILED:
// No further processing in this service window.
dougarnett 2016/10/18 17:26:32 Nice, maybe also add same comment as other call si
romax 2016/10/18 20:31:51 Done.
+ scheduler_callback_.Run(true);
break;
default:
// Make explicit choice about new status codes that actually reach here.

Powered by Google App Engine
This is Rietveld 408576698