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

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

Issue 2317893002: [Offline Pages] Close race condition of multiple StartProcessing callers. (Closed)
Patch Set: Some unittest coverage on new is_starting_ flag 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..b7215c5328f40b271de69493175fbec2476070cf 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -150,6 +150,12 @@ 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 +270,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