Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 std::unique_ptr<RequestQueue> queue, | 43 std::unique_ptr<RequestQueue> queue, |
| 44 std::unique_ptr<Scheduler> scheduler); | 44 std::unique_ptr<Scheduler> scheduler); |
| 45 | 45 |
| 46 ~RequestCoordinator() override; | 46 ~RequestCoordinator() override; |
| 47 | 47 |
| 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 // Cancel a list of requests by |client_id|. This removes requests from the | |
| 54 // request queue, but does not cancel an in-progress pre-render. | |
|
dougarnett
2016/07/29 19:01:23
interesting question about how to deal with a pend
Pete Williamson
2016/07/29 22:48:52
Per offline discussion, let's leave this as is, an
| |
| 55 void CancelRequests(const std::vector<ClientId>& client_ids); | |
|
dougarnett
2016/07/29 19:01:24
RemoveRequests more accurate since removed request
Pete Williamson
2016/07/29 22:48:52
Done.
| |
| 56 | |
| 53 // Starts processing of one or more queued save page later requests. | 57 // Starts processing of one or more queued save page later requests. |
| 54 // Returns whether processing was started and that caller should expect | 58 // Returns whether processing was started and that caller should expect |
| 55 // a callback. If processing was already active, returns false. | 59 // a callback. If processing was already active, returns false. |
| 56 bool StartProcessing(const DeviceConditions& device_conditions, | 60 bool StartProcessing(const DeviceConditions& device_conditions, |
| 57 const base::Callback<void(bool)>& callback); | 61 const base::Callback<void(bool)>& callback); |
| 58 | 62 |
| 59 // Stops the current request processing if active. This is a way for | 63 // Stops the current request processing if active. This is a way for |
| 60 // caller to abort processing; otherwise, processing will complete on | 64 // caller to abort processing; otherwise, processing will complete on |
| 61 // its own. In either case, the callback will be called when processing | 65 // its own. In either case, the callback will be called when processing |
| 62 // is stopped or complete. | 66 // is stopped or complete. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 base::TimeDelta offliner_timeout_; | 166 base::TimeDelta offliner_timeout_; |
| 163 // Allows us to pass a weak pointer to callbacks. | 167 // Allows us to pass a weak pointer to callbacks. |
| 164 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; | 168 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |
| 165 | 169 |
| 166 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 170 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
| 167 }; | 171 }; |
| 168 | 172 |
| 169 } // namespace offline_pages | 173 } // namespace offline_pages |
| 170 | 174 |
| 171 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 175 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| OLD | NEW |