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

Side by Side Diff: components/offline_pages/background/request_coordinator.h

Issue 2221323003: Add an API to Pause and Resume background offlining requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit test break introduced by merge Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // Queues |request| to later load and save when system conditions allow. 48 // Queues |request| to later load and save when system conditions allow.
49 // Returns true if the page could be queued successfully. 49 // Returns true if the page could be queued successfully.
50 bool SavePageLater( 50 bool SavePageLater(
51 const GURL& url, const ClientId& client_id, bool user_reqeusted); 51 const GURL& url, const ClientId& client_id, bool user_reqeusted);
52 52
53 // Remove a list of requests by |request_id|. This removes requests from the 53 // Remove a list of requests by |request_id|. This removes requests from the
54 // request queue, but does not cancel an in-progress pre-render. 54 // request queue, but does not cancel an in-progress pre-render.
55 // TODO(petewil): Add code to cancel an in-progress pre-render. 55 // TODO(petewil): Add code to cancel an in-progress pre-render.
56 void RemoveRequests(const std::vector<int64_t>& request_ids); 56 void RemoveRequests(const std::vector<int64_t>& request_ids);
57 57
58 // Callback that receives the response for GetRequests. Client must 58 // Pause a list of requests by |request_id|. This will change the state
59 // in the request queue so the request cannot be started.
60 // TODO(petewil): Add code to cancel an in-progress pre-render.
61 void PauseRequests(const std::vector<int64_t>& request_ids);
62
63 // Resume a list of previously paused requests, making them available.
64 void ResumeRequests(const std::vector<int64_t>& request_ids);
65
66 // Callback that receives the response for GetAllRequests. Client must
59 // copy the result right away, it goes out of scope at the end of the 67 // copy the result right away, it goes out of scope at the end of the
60 // callback. 68 // callback.
61 typedef base::Callback<void(const std::vector<SavePageRequest>&)> 69 typedef base::Callback<void(const std::vector<SavePageRequest>&)>
62 GetRequestsCallback; 70 GetRequestsCallback;
63 71
64 // Get all save page request items in the callback. 72 // Get all save page request items in the callback.
65 void GetAllRequests(const GetRequestsCallback& callback); 73 void GetAllRequests(const GetRequestsCallback& callback);
66 74
67 // Starts processing of one or more queued save page later requests. 75 // Starts processing of one or more queued save page later requests.
68 // Returns whether processing was started and that caller should expect 76 // Returns whether processing was started and that caller should expect
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 base::TimeDelta offliner_timeout_; 200 base::TimeDelta offliner_timeout_;
193 // Allows us to pass a weak pointer to callbacks. 201 // Allows us to pass a weak pointer to callbacks.
194 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; 202 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_;
195 203
196 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); 204 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator);
197 }; 205 };
198 206
199 } // namespace offline_pages 207 } // namespace offline_pages
200 208
201 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 209 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
OLDNEW
« 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