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 #include "components/offline_pages/background/request_picker.h" | 5 #include "components/offline_pages/background/request_picker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "components/offline_pages/background/save_page_request.h" | 9 #include "components/offline_pages/background/save_page_request.h" |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 template <typename T> | 12 template <typename T> |
| 13 int signum(T t) { | 13 int signum(T t) { |
| 14 return (T(0) < t) - (t < T(0)); | 14 return (T(0) < t) - (t < T(0)); |
| 15 } | 15 } |
| 16 | 16 |
| 17 #define CALL_MEMBER_FUNCTION(object,ptrToMember) ((object)->*(ptrToMember)) | 17 #define CALL_MEMBER_FUNCTION(object, ptrToMember) ((object)->*(ptrToMember)) |
| 18 } // namespace | 18 } // namespace |
| 19 | 19 |
| 20 namespace offline_pages { | 20 namespace offline_pages { |
| 21 | 21 |
| 22 RequestPicker::RequestPicker(RequestQueue* requestQueue, | 22 RequestPicker::RequestPicker(RequestQueue* requestQueue, |
| 23 OfflinerPolicy* policy, | 23 OfflinerPolicy* policy, |
| 24 RequestNotifier* notifier) | 24 RequestNotifier* notifier) |
| 25 : queue_(requestQueue), | 25 : queue_(requestQueue), |
| 26 policy_(policy), | 26 policy_(policy), |
| 27 notifier_(notifier), | 27 notifier_(notifier), |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 // Callback used after expired requests are deleted from the queue and notifies | 254 // Callback used after expired requests are deleted from the queue and notifies |
| 255 // the coordinator. | 255 // the coordinator. |
| 256 void RequestPicker::OnRequestExpired( | 256 void RequestPicker::OnRequestExpired( |
| 257 const RequestQueue::UpdateMultipleRequestResults& results, | 257 const RequestQueue::UpdateMultipleRequestResults& results, |
| 258 const std::vector<std::unique_ptr<SavePageRequest>> requests) { | 258 const std::vector<std::unique_ptr<SavePageRequest>> requests) { |
| 259 std::vector<std::unique_ptr<SavePageRequest>>::const_iterator request; | 259 std::vector<std::unique_ptr<SavePageRequest>>::const_iterator request; |
| 260 for (request = requests.begin(); request != requests.end(); ++request) | 260 for (request = requests.begin(); request != requests.end(); ++request) { |
| 261 notifier_->NotifyCompleted( | 261 notifier_->NotifyCompleted( |
| 262 *(request->get()), | 262 *(request->get()), |
| 263 RequestCoordinator::BackgroundSavePageResult::EXPIRED); | 263 RequestCoordinator::BackgroundSavePageResult::EXPIRED); |
| 264 // TODO(dougarnett): Plumb in event logger and RecordDroppedSavePageRequest | |
|
Pete Williamson
2016/09/09 17:16:19
This seems to my untrained eyes like a small amoun
dougarnett
2016/09/09 23:58:21
Really just have a design question here about shou
Pete Williamson
2016/09/10 00:14:13
Yes, please, if it isn't a lot of work. If it is,
dougarnett
2016/09/12 18:31:38
Done.
| |
| 265 } | |
| 264 } | 266 } |
| 265 | 267 |
| 266 } // namespace offline_pages | 268 } // namespace offline_pages |
| OLD | NEW |