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

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

Issue 2775223006: [Offline Pages] Improve RequestCoordinator state tracking. (Closed)
Patch Set: minor comment fix. Created 3 years, 9 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/core/background/request_coordinator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/core/background/request_coordinator.h
diff --git a/components/offline_pages/core/background/request_coordinator.h b/components/offline_pages/core/background/request_coordinator.h
index 30ac8eb248a3b26754bf78c5c2888efd408ee2cd..6103f0b870fb00abb73f40bd5838875412f4392a 100644
--- a/components/offline_pages/core/background/request_coordinator.h
+++ b/components/offline_pages/core/background/request_coordinator.h
@@ -62,6 +62,12 @@ class RequestCoordinator : public KeyedService,
DISABLED_FOR_OFFLINER,
};
+ enum class RequestCoordinatorState {
+ IDLE,
+ PICKING,
+ OFFLINING,
+ };
+
// Describes the parameters to control how to save a page when system
// conditions allow.
struct SavePageLaterParams {
@@ -204,11 +210,8 @@ class RequestCoordinator : public KeyedService,
return last_offlining_status_;
}
- bool is_busy() { return is_busy_; }
-
- // Returns whether processing is starting (before it is decided to actually
- // process a request (is_busy()) at this time or not.
- bool is_starting() { return is_starting_; }
+ // Return the state of the request coordinator.
+ RequestCoordinatorState state() { return state_; }
// Tracks whether the last offlining attempt got canceled. This is reset by
// the next call to start processing.
@@ -406,13 +409,8 @@ class RequestCoordinator : public KeyedService,
// Cached value of whether low end device. Overwritable for testing.
bool is_low_end_device_;
- // The offliner can only handle one request at a time - if the offliner is
- // busy, prevent other requests. This flag marks whether the offliner is in
- // use.
- bool is_busy_;
- // 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_;
+ // Current state of the request coordinator.
+ RequestCoordinatorState state_;
// Identifies the type of current processing window or if processing stopped.
ProcessingWindowState processing_state_;
// True if we should use the test device conditions instead of actual
« no previous file with comments | « no previous file | components/offline_pages/core/background/request_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698