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

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

Issue 2266323002: Cancel prerendering when a request is paused or removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR feedback per DougArnett 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 unified diff | Download patch
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 void RemoveRequestsCallback( 167 void RemoveRequestsCallback(
168 const RequestQueue::UpdateMultipleRequestResults& results, 168 const RequestQueue::UpdateMultipleRequestResults& results,
169 const std::vector<SavePageRequest>& requests); 169 const std::vector<SavePageRequest>& requests);
170 170
171 // Callback from the request picker when it has chosen our next request. 171 // Callback from the request picker when it has chosen our next request.
172 void RequestPicked(const SavePageRequest& request); 172 void RequestPicked(const SavePageRequest& request);
173 173
174 // Callback from the request picker when no more requests are in the queue. 174 // Callback from the request picker when no more requests are in the queue.
175 void RequestQueueEmpty(); 175 void RequestQueueEmpty();
176 176
177 // Cancels an in progress pre-rendering, and updates state appropriately.
178 void StopPrerendering();
179
177 void SendRequestToOffliner(const SavePageRequest& request); 180 void SendRequestToOffliner(const SavePageRequest& request);
178 181
179 // Called by the offliner when an offlining request is completed. (and by 182 // Called by the offliner when an offlining request is completed. (and by
180 // tests). 183 // tests).
181 void OfflinerDoneCallback(const SavePageRequest& request, 184 void OfflinerDoneCallback(const SavePageRequest& request,
182 Offliner::RequestStatus status); 185 Offliner::RequestStatus status);
183 186
184 void TryNextRequest(); 187 void TryNextRequest();
185 188
189 // If there is an active request in the list, cancel that request.
190 bool CancelActiveRequestIfItMatches(const std::vector<int64_t>& request_ids);
191
186 // Returns the appropriate offliner to use, getting a new one from the factory 192 // Returns the appropriate offliner to use, getting a new one from the factory
187 // if needed. 193 // if needed.
188 void GetOffliner(); 194 void GetOffliner();
189 195
190 void SetOfflinerTimeoutForTest(const base::TimeDelta& timeout) { 196 void SetOfflinerTimeoutForTest(const base::TimeDelta& timeout) {
191 offliner_timeout_ = timeout; 197 offliner_timeout_ = timeout;
192 } 198 }
193 199
194 void SetDeviceConditionsForTest(DeviceConditions& current_conditions) { 200 void SetDeviceConditionsForTest(DeviceConditions& current_conditions) {
195 current_conditions_.reset(new DeviceConditions(current_conditions)); 201 current_conditions_.reset(new DeviceConditions(current_conditions));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 base::TimeDelta offliner_timeout_; 240 base::TimeDelta offliner_timeout_;
235 // Allows us to pass a weak pointer to callbacks. 241 // Allows us to pass a weak pointer to callbacks.
236 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; 242 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_;
237 243
238 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); 244 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator);
239 }; 245 };
240 246
241 } // namespace offline_pages 247 } // namespace offline_pages
242 248
243 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 249 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698