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

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

Issue 2373933003: [Offline pages] Updating RequestQueue::RemoveRequests to use a TaskQueue (Closed)
Patch Set: Addressing final feedback Created 4 years, 2 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_PICKER_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_PICKER_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_PICKER_H_ 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_PICKER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 const SavePageRequest* right); 71 const SavePageRequest* right);
72 72
73 // Split all requests into expired ones and still valid ones. Takes ownership 73 // Split all requests into expired ones and still valid ones. Takes ownership
74 // of the requests, and moves them into either valid or expired requests. 74 // of the requests, and moves them into either valid or expired requests.
75 void SplitRequests( 75 void SplitRequests(
76 std::vector<std::unique_ptr<SavePageRequest>> requests, 76 std::vector<std::unique_ptr<SavePageRequest>> requests,
77 std::vector<std::unique_ptr<SavePageRequest>>* valid_requests, 77 std::vector<std::unique_ptr<SavePageRequest>>* valid_requests,
78 std::vector<std::unique_ptr<SavePageRequest>>* expired_requests); 78 std::vector<std::unique_ptr<SavePageRequest>>* expired_requests);
79 79
80 // Callback used after requests get expired. 80 // Callback used after requests get expired.
81 void OnRequestExpired( 81 void OnRequestExpired(std::unique_ptr<UpdateRequestsResult> result);
82 const RequestQueue::UpdateMultipleRequestResults& results,
83 const std::vector<std::unique_ptr<SavePageRequest>> requests);
84 82
85 // Unowned pointer to the request queue. 83 // Unowned pointer to the request queue.
86 RequestQueue* queue_; 84 RequestQueue* queue_;
87 // Unowned pointer to the policy object. 85 // Unowned pointer to the policy object.
88 OfflinerPolicy* policy_; 86 OfflinerPolicy* policy_;
89 // Unowned pointer to the request coordinator. 87 // Unowned pointer to the request coordinator.
90 RequestNotifier* notifier_; 88 RequestNotifier* notifier_;
91 // Unowned pointer to the event logger. 89 // Unowned pointer to the event logger.
92 RequestCoordinatorEventLogger* event_logger_; 90 RequestCoordinatorEventLogger* event_logger_;
93 // Current conditions on the device 91 // Current conditions on the device
94 std::unique_ptr<DeviceConditions> current_conditions_; 92 std::unique_ptr<DeviceConditions> current_conditions_;
95 // True if we prefer less-tried requests 93 // True if we prefer less-tried requests
96 bool fewer_retries_better_; 94 bool fewer_retries_better_;
97 // True if we prefer requests submitted more recently 95 // True if we prefer requests submitted more recently
98 bool earlier_requests_better_; 96 bool earlier_requests_better_;
99 // Callback for when we are done picking a request to do next. 97 // Callback for when we are done picking a request to do next.
100 RequestCoordinator::RequestPickedCallback picked_callback_; 98 RequestCoordinator::RequestPickedCallback picked_callback_;
101 // Callback for when there are no more reqeusts to pick. 99 // Callback for when there are no more reqeusts to pick.
102 RequestCoordinator::RequestNotPickedCallback not_picked_callback_; 100 RequestCoordinator::RequestNotPickedCallback not_picked_callback_;
103 // Allows us to pass a weak pointer to callbacks. 101 // Allows us to pass a weak pointer to callbacks.
104 base::WeakPtrFactory<RequestPicker> weak_ptr_factory_; 102 base::WeakPtrFactory<RequestPicker> weak_ptr_factory_;
105 }; 103 };
106 104
107 } // namespace offline_pages 105 } // namespace offline_pages
108 106
109 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_PICKER_H_ 107 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_PICKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698