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

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

Issue 2317893002: [Offline Pages] Close race condition of multiple StartProcessing callers. (Closed)
Patch Set: Pete feedback - clear starting flag in deadbeat timeout case Created 4 years, 3 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 e5745896a658af0814843642fbf558e6fc770ea0..1e7abf615640799ef7580597fcaed44ba7e3a1b5 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -150,6 +150,10 @@ class RequestCoordinator : public KeyedService,
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_; }
+
// Tracks whether the last offlining attempt got canceled. This is reset by
// the next StartProcessing() call.
bool is_canceled() {
@@ -264,7 +268,10 @@ class RequestCoordinator : public KeyedService,
// busy, prevent other requests. This flag marks whether the offliner is in
// use.
bool is_busy_;
- // True if the current request has been canceled.
+ // 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_;
// True if we should use the test connection type instead of the actual type.
bool use_test_connection_type_;

Powered by Google App Engine
This is Rietveld 408576698