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

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

Issue 2091473004: Add the ability to cancel prerender reqeusts and tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment changes per DougArnett Created 4 years, 6 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/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/background/request_coordinator.h
diff --git a/components/offline_pages/background/request_coordinator.h b/components/offline_pages/background/request_coordinator.h
index d04ba515fa9f00c1a7fbfb41365a4431db9924a5..cab867f2ef0546fd742ee85cb78e9d9f7507d3d5 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -81,6 +81,12 @@ class RequestCoordinator : public KeyedService {
return is_busy_;
}
+ // Tracks whether the last offlining attempt got canceled. This is reset by
+ // the next StartProcessing() call.
+ bool is_canceled() {
+ return is_canceled_;
+ }
+
private:
void AddRequestResultCallback(RequestQueue::AddRequestResult result,
const SavePageRequest& request);
@@ -102,12 +108,20 @@ class RequestCoordinator : public KeyedService {
void TryNextRequest();
+ // Returns the appropriate offliner to use, getting a new one from the factory
+ // if needed.
+ void GetOffliner();
+
friend class RequestCoordinatorTest;
// 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_;
+ // True if the current request has been canceled.
+ bool is_canceled_;
+ // Unowned pointer to the current offliner, if any.
+ Offliner* offliner_;
// RequestCoordinator takes over ownership of the policy
std::unique_ptr<OfflinerPolicy> policy_;
// OfflinerFactory. Used to create offline pages. Owned.
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698