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

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

Issue 2425873003: [Offline Pages] Add evaluation test support in RequestCoordinator. (Closed)
Patch Set: Addressed comments. 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..81d90f15620fc27f6a2dd8abcafe48623e2aa976 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),
+ immediate_schedule_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, immediate_schedule_callback_))
return OfflinerImmediateStartStatus::STARTED;
else
return OfflinerImmediateStartStatus::NOT_ACCEPTED;
@@ -646,6 +647,8 @@ void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request,
case Offliner::RequestStatus::PRERENDERING_CANCELED:
case Offliner::RequestStatus::PRERENDERING_FAILED:
// No further processing in this service window.
+ // Let the scheduler know we are done processing.
+ 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