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_coordinator.h" | 5 #include "components/offline_pages/background/request_coordinator.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 weak_ptr_factory_.GetWeakPtr())); | 130 weak_ptr_factory_.GetWeakPtr())); |
131 } | 131 } |
132 | 132 |
133 void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request, | 133 void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request, |
134 Offliner::RequestStatus status) { | 134 Offliner::RequestStatus status) { |
135 DVLOG(2) << "offliner finished, saved: " | 135 DVLOG(2) << "offliner finished, saved: " |
136 << (status == Offliner::RequestStatus::SAVED) << ", " | 136 << (status == Offliner::RequestStatus::SAVED) << ", " |
137 << __FUNCTION__; | 137 << __FUNCTION__; |
138 last_offlining_status_ = status; | 138 last_offlining_status_ = status; |
139 | 139 |
140 // TODO(petewil): If the request succeeded, remove it from the Queue. | 140 // If the request succeeded, remove it from the Queue and maybe schedule |
| 141 // another one. |
141 if (status == Offliner::RequestStatus::SAVED) { | 142 if (status == Offliner::RequestStatus::SAVED) { |
142 queue_->RemoveRequest(request.request_id(), | 143 queue_->RemoveRequest(request.request_id(), |
143 base::Bind(&RequestCoordinator::UpdateRequestCallback, | 144 base::Bind(&RequestCoordinator::UpdateRequestCallback, |
144 weak_ptr_factory_.GetWeakPtr())); | 145 weak_ptr_factory_.GetWeakPtr())); |
| 146 |
| 147 // TODO(petewil): Check time budget. Return to the scheduler if we are out. |
| 148 |
| 149 // Start another request if we have time. |
| 150 TryNextRequest(); |
145 } | 151 } |
146 | |
147 // TODO(petewil): Check time budget. Return to the scheduler if we are out. | |
148 | |
149 // Start a request if we have time. | |
150 TryNextRequest(); | |
151 } | 152 } |
152 | 153 |
153 } // namespace offline_pages | 154 } // namespace offline_pages |
OLD | NEW |