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

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

Issue 2493683002: [OfflinePages] Fixes RequestCoordinator bug not clearing state on timeout (Closed)
Patch Set: Merge Created 4 years, 1 month 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 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // started. 287 // started.
288 void StartOffliner(int64_t request_id, 288 void StartOffliner(int64_t request_id,
289 const std::string& client_namespace, 289 const std::string& client_namespace,
290 std::unique_ptr<UpdateRequestsResult> update_result); 290 std::unique_ptr<UpdateRequestsResult> update_result);
291 291
292 // Called by the offliner when an offlining request is completed. (and by 292 // Called by the offliner when an offlining request is completed. (and by
293 // tests). 293 // tests).
294 void OfflinerDoneCallback(const SavePageRequest& request, 294 void OfflinerDoneCallback(const SavePageRequest& request,
295 Offliner::RequestStatus status); 295 Offliner::RequestStatus status);
296 296
297 // Records a completed attempt for the request and update it in the queue
298 // (possibly removing it).
299 void UpdateRequestForCompletedAttempt(const SavePageRequest& request,
300 Offliner::RequestStatus status);
301
302 // Returns whether we should try another request based on the outcome
303 // of the previous one.
304 bool ShouldTryNextRequest(Offliner::RequestStatus previous_request_status);
305
297 void TryNextRequest(); 306 void TryNextRequest();
298 307
299 // If there is an active request in the list, cancel that request. 308 // If there is an active request in the list, cancel that request.
300 bool CancelActiveRequestIfItMatches(const std::vector<int64_t>& request_ids); 309 bool CancelActiveRequestIfItMatches(const std::vector<int64_t>& request_ids);
301 310
302 // Records an aborted attempt for the request and update it in the queue 311 // Records an aborted attempt for the request and update it in the queue
303 // (possibly removing it). Returns the updated copy. 312 // (possibly removing it).
304 void AbortRequestAttempt(const SavePageRequest& request); 313 void UpdateRequestForAbortedAttempt(const SavePageRequest& request);
305 314
306 // Remove the attempted request from the queue with status to pass through to 315 // Remove the attempted request from the queue with status to pass through to
307 // any observers and UMA histogram. 316 // any observers and UMA histogram.
308 void RemoveAttemptedRequest(const SavePageRequest& request, 317 void RemoveAttemptedRequest(const SavePageRequest& request,
309 BackgroundSavePageResult status); 318 BackgroundSavePageResult status);
310 319
311 // Completes aborting the request, reports an error if it fails. 320 // Completes aborting the request, reports an error if it fails.
312 void MarkAttemptAbortedDone(int64_t request_id, 321 void MarkAttemptAbortedDone(int64_t request_id,
313 const ClientId& client_id, 322 const ClientId& client_id,
314 std::unique_ptr<UpdateRequestsResult> result); 323 std::unique_ptr<UpdateRequestsResult> result);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 base::Callback<void(bool)> immediate_schedule_callback_; 398 base::Callback<void(bool)> immediate_schedule_callback_;
390 // Allows us to pass a weak pointer to callbacks. 399 // Allows us to pass a weak pointer to callbacks.
391 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; 400 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_;
392 401
393 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); 402 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator);
394 }; 403 };
395 404
396 } // namespace offline_pages 405 } // namespace offline_pages
397 406
398 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 407 #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