| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 active_request_->client_id())); | 122 active_request_->client_id())); |
| 123 } | 123 } |
| 124 | 124 |
| 125 // Stopping offliner means it will not call callback. | 125 // Stopping offliner means it will not call callback. |
| 126 last_offlining_status_ = | 126 last_offlining_status_ = |
| 127 Offliner::RequestStatus::REQUEST_COORDINATOR_CANCELED; | 127 Offliner::RequestStatus::REQUEST_COORDINATOR_CANCELED; |
| 128 | 128 |
| 129 if (active_request_) { | 129 if (active_request_) { |
| 130 RecordOfflinerResultUMA(active_request_->client_id(), | 130 RecordOfflinerResultUMA(active_request_->client_id(), |
| 131 last_offlining_status_); | 131 last_offlining_status_); |
| 132 is_busy_ = false; |
| 132 active_request_.reset(); | 133 active_request_.reset(); |
| 133 } | 134 } |
| 134 | 135 |
| 135 } | 136 } |
| 136 | 137 |
| 137 bool RequestCoordinator::CancelActiveRequestIfItMatches( | 138 bool RequestCoordinator::CancelActiveRequestIfItMatches( |
| 138 const std::vector<int64_t>& request_ids) { | 139 const std::vector<int64_t>& request_ids) { |
| 139 // If we have a request in progress and need to cancel it, call the | 140 // If we have a request in progress and need to cancel it, call the |
| 140 // pre-renderer to cancel. TODO Make sure we remove any page created by the | 141 // pre-renderer to cancel. TODO Make sure we remove any page created by the |
| 141 // prerenderer if it doesn't get the cancel in time. | 142 // prerenderer if it doesn't get the cancel in time. |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 FOR_EACH_OBSERVER(Observer, observers_, OnChanged(request)); | 449 FOR_EACH_OBSERVER(Observer, observers_, OnChanged(request)); |
| 449 } | 450 } |
| 450 | 451 |
| 451 void RequestCoordinator::GetOffliner() { | 452 void RequestCoordinator::GetOffliner() { |
| 452 if (!offliner_) { | 453 if (!offliner_) { |
| 453 offliner_ = factory_->GetOffliner(policy_.get()); | 454 offliner_ = factory_->GetOffliner(policy_.get()); |
| 454 } | 455 } |
| 455 } | 456 } |
| 456 | 457 |
| 457 } // namespace offline_pages | 458 } // namespace offline_pages |
| OLD | NEW |