| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 std::vector<std::unique_ptr<SavePageRequest>> requests) { | 211 std::vector<std::unique_ptr<SavePageRequest>> requests) { |
| 212 callback.Run(std::move(requests)); | 212 callback.Run(std::move(requests)); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void RequestCoordinator::StopPrerendering(Offliner::RequestStatus stop_status) { | 215 void RequestCoordinator::StopPrerendering(Offliner::RequestStatus stop_status) { |
| 216 if (offliner_ && is_busy_) { | 216 if (offliner_ && is_busy_) { |
| 217 DCHECK(active_request_.get()); | 217 DCHECK(active_request_.get()); |
| 218 offliner_->Cancel(); | 218 offliner_->Cancel(); |
| 219 | 219 |
| 220 // If we timed out, let the offliner done callback handle it. | 220 // If we timed out, let the offliner done callback handle it. |
| 221 if (processing_state_ == ProcessingWindowState::IMMEDIATE_WINDOW && | 221 if (stop_status == Offliner::RequestStatus::REQUEST_COORDINATOR_TIMED_OUT) |
| 222 stop_status == Offliner::RequestStatus::REQUEST_COORDINATOR_TIMED_OUT) | |
| 223 return; | 222 return; |
| 224 | 223 |
| 225 // Otherwise, this attempt never really had a chance to run, mark it | 224 // Otherwise, this attempt never really had a chance to run, mark it |
| 226 // aborted. | 225 // aborted. |
| 227 AbortRequestAttempt(active_request_.get()); | 226 AbortRequestAttempt(active_request_.get()); |
| 228 } | 227 } |
| 229 | 228 |
| 230 // Stopping offliner means it will not call callback so set last status. | 229 // Stopping offliner means it will not call callback so set last status. |
| 231 last_offlining_status_ = stop_status; | 230 last_offlining_status_ = stop_status; |
| 232 | 231 |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 | 825 |
| 827 ClientPolicyController* RequestCoordinator::GetPolicyController() { | 826 ClientPolicyController* RequestCoordinator::GetPolicyController() { |
| 828 return policy_controller_.get(); | 827 return policy_controller_.get(); |
| 829 } | 828 } |
| 830 | 829 |
| 831 void RequestCoordinator::Shutdown() { | 830 void RequestCoordinator::Shutdown() { |
| 832 network_quality_estimator_ = nullptr; | 831 network_quality_estimator_ = nullptr; |
| 833 } | 832 } |
| 834 | 833 |
| 835 } // namespace offline_pages | 834 } // namespace offline_pages |
| OLD | NEW |