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

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

Issue 2269173003: Adjust scheduling for non-user requested items (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_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 14 matching lines...) Expand all
25 RequestPicker(RequestQueue* requestQueue, 25 RequestPicker(RequestQueue* requestQueue,
26 OfflinerPolicy* policy, 26 OfflinerPolicy* policy,
27 RequestNotifier* notifier); 27 RequestNotifier* notifier);
28 28
29 ~RequestPicker(); 29 ~RequestPicker();
30 30
31 // Choose which request we should process next based on the current 31 // Choose which request we should process next based on the current
32 // conditions, and call back to the RequestCoordinator when we have one. 32 // conditions, and call back to the RequestCoordinator when we have one.
33 void ChooseNextRequest( 33 void ChooseNextRequest(
34 RequestCoordinator::RequestPickedCallback picked_callback, 34 RequestCoordinator::RequestPickedCallback picked_callback,
35 RequestCoordinator::RequestQueueEmptyCallback empty_callback, 35 RequestCoordinator::RequestNotPickedCallback empty_callback,
dougarnett 2016/09/01 18:24:13 not_picked_callback ?
Pete Williamson 2016/09/01 21:56:08 Done.
36 DeviceConditions* device_conditions); 36 DeviceConditions* device_conditions);
37 37
38 private: 38 private:
39 // Callback for the GetRequest results to be delivered. 39 // Callback for the GetRequest results to be delivered.
40 void GetRequestResultCallback(RequestQueue::GetRequestsResult result, 40 void GetRequestResultCallback(RequestQueue::GetRequestsResult result,
41 const std::vector<SavePageRequest>& results); 41 const std::vector<SavePageRequest>& results);
42 42
43 // Filter out requests that don't meet the current conditions. For instance, 43 // Filter out requests that don't meet the current conditions. For instance,
44 // if this is a predictive request, and we are not on WiFi, it should be 44 // if this is a predictive request, and we are not on WiFi, it should be
45 // ignored this round. 45 // ignored this round.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 RequestNotifier* notifier_; 85 RequestNotifier* notifier_;
86 // Current conditions on the device 86 // Current conditions on the device
87 std::unique_ptr<DeviceConditions> current_conditions_; 87 std::unique_ptr<DeviceConditions> current_conditions_;
88 // True if we prefer less-tried requests 88 // True if we prefer less-tried requests
89 bool fewer_retries_better_; 89 bool fewer_retries_better_;
90 // True if we prefer requests submitted more recently 90 // True if we prefer requests submitted more recently
91 bool earlier_requests_better_; 91 bool earlier_requests_better_;
92 // Callback for when we are done picking a request to do next. 92 // Callback for when we are done picking a request to do next.
93 RequestCoordinator::RequestPickedCallback picked_callback_; 93 RequestCoordinator::RequestPickedCallback picked_callback_;
94 // Callback for when there are no more reqeusts to pick. 94 // Callback for when there are no more reqeusts to pick.
95 RequestCoordinator::RequestQueueEmptyCallback empty_callback_; 95 RequestCoordinator::RequestNotPickedCallback not_picked_callback_;
96 // Allows us to pass a weak pointer to callbacks. 96 // Allows us to pass a weak pointer to callbacks.
97 base::WeakPtrFactory<RequestPicker> weak_ptr_factory_; 97 base::WeakPtrFactory<RequestPicker> weak_ptr_factory_;
98 }; 98 };
99 99
100 } // namespace offline_pages 100 } // namespace offline_pages
101 101
102 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_PICKER_H_ 102 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_PICKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698