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

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

Issue 2420503002: [Offline Pages] Define separate watchdog timeout for concurrent bg loads (Closed)
Patch Set: Merge 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.h
diff --git a/components/offline_pages/background/request_coordinator.h b/components/offline_pages/background/request_coordinator.h
index b03fe85ded0986ea96e360dc5b32110acdc892bc..9b70fc4cddf6c9f86d0a1a202757de072f094587 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -178,7 +178,7 @@ class RequestCoordinator : public KeyedService,
// Tracks whether the last offlining attempt got canceled. This is reset by
// the next StartProcessing() call.
bool is_canceled() {
- return is_stopped_;
+ return processing_state_ == ProcessingWindowState::STOPPED;
}
OfflineEventLogger* GetLogger() {
@@ -208,6 +208,12 @@ class RequestCoordinator : public KeyedService,
STATUS_COUNT = 6,
};
+ enum class ProcessingWindowState {
+ STOPPED,
+ SCHEDULED_WINDOW,
+ IMMEDIATE_WINDOW,
+ };
+
// Receives the results of a get from the request queue, and turns that into
// SavePageRequest objects for the caller of GetQueuedRequests.
void GetQueuedRequestsCallback(
@@ -242,9 +248,13 @@ class RequestCoordinator : public KeyedService,
void HandleRemovedRequests(BackgroundSavePageResult status,
std::unique_ptr<UpdateRequestsResult> result);
+ bool StartProcessingInternal(const ProcessingWindowState processing_state,
+ const DeviceConditions& device_conditions,
+ const base::Callback<void(bool)>& callback);
+
// Start processing now if connected (but with conservative assumption
// as to other device conditions).
- void StartProcessingIfConnected();
+ void StartImmediatelyIfConnected();
OfflinerImmediateStartStatus TryImmediateStart();
@@ -320,8 +330,8 @@ class RequestCoordinator : public KeyedService,
// There is more than one path to start processing so this flag is used
// to avoid race conditions before is_busy_ is established.
bool is_starting_;
- // True if the current processing window has been canceled.
- bool is_stopped_;
+ // Identifies the type of current processing window or if processing stopped.
+ ProcessingWindowState processing_state_;
Pete Williamson 2016/10/13 22:58:18 Good change, I like this a lot better.
dougarnett 2016/10/14 16:27:01 Done.
// True if we should use the test connection type instead of the actual type.
bool use_test_connection_type_;
// For use by tests, a fake network connection type

Powered by Google App Engine
This is Rietveld 408576698