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_coordinator.h" | 5 #include "components/offline_pages/background/request_coordinator.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 const GetRequestsCallback& callback, | 204 const GetRequestsCallback& callback, |
| 205 RequestQueue::GetRequestsResult result, | 205 RequestQueue::GetRequestsResult result, |
| 206 std::vector<std::unique_ptr<SavePageRequest>> requests) { | 206 std::vector<std::unique_ptr<SavePageRequest>> requests) { |
| 207 callback.Run(std::move(requests)); | 207 callback.Run(std::move(requests)); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void RequestCoordinator::StopPrerendering(Offliner::RequestStatus stop_status) { | 210 void RequestCoordinator::StopPrerendering(Offliner::RequestStatus stop_status) { |
| 211 if (offliner_ && is_busy_) { | 211 if (offliner_ && is_busy_) { |
| 212 DCHECK(active_request_.get()); | 212 DCHECK(active_request_.get()); |
| 213 offliner_->Cancel(); | 213 offliner_->Cancel(); |
| 214 | |
| 215 // If we timed out, let the offliner done callback handle it. | |
|
dougarnett
2016/10/28 16:13:11
This will dramatically diminish the success rate f
Pete Williamson
2016/10/28 18:32:38
Done.
| |
| 216 if (stop_status == Offliner::RequestStatus::REQUEST_COORDINATOR_TIMED_OUT) | |
| 217 return; | |
| 218 | |
| 219 // Otherwise, this attempt never really had a chance to run, mark it | |
| 220 // aborted. | |
| 214 AbortRequestAttempt(active_request_.get()); | 221 AbortRequestAttempt(active_request_.get()); |
| 215 } | 222 } |
| 216 | 223 |
| 217 // Stopping offliner means it will not call callback so set last status. | 224 // Stopping offliner means it will not call callback so set last status. |
| 218 last_offlining_status_ = stop_status; | 225 last_offlining_status_ = stop_status; |
| 219 | 226 |
| 220 if (active_request_) { | 227 if (active_request_) { |
| 221 event_logger_.RecordOfflinerResult(active_request_->client_id().name_space, | 228 event_logger_.RecordOfflinerResult(active_request_->client_id().name_space, |
| 222 last_offlining_status_, | 229 last_offlining_status_, |
| 223 active_request_->request_id()); | 230 active_request_->request_id()); |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 809 | 816 |
| 810 ClientPolicyController* RequestCoordinator::GetPolicyController() { | 817 ClientPolicyController* RequestCoordinator::GetPolicyController() { |
| 811 return policy_controller_.get(); | 818 return policy_controller_.get(); |
| 812 } | 819 } |
| 813 | 820 |
| 814 void RequestCoordinator::Shutdown() { | 821 void RequestCoordinator::Shutdown() { |
| 815 network_quality_estimator_ = nullptr; | 822 network_quality_estimator_ = nullptr; |
| 816 } | 823 } |
| 817 | 824 |
| 818 } // namespace offline_pages | 825 } // namespace offline_pages |
| OLD | NEW |