Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: components/offline_pages/background/request_coordinator.cc

Issue 2454123003: count timeout as a completed attempt. (Closed)
Patch Set: merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 214
215 // If we timed out, let the offliner done callback handle it.
216 if (processing_state_ == ProcessingWindowState::IMMEDIATE_WINDOW &&
217 stop_status == Offliner::RequestStatus::REQUEST_COORDINATOR_TIMED_OUT)
218 return;
219
220 // Otherwise, this attempt never really had a chance to run, mark it
221 // aborted.
215 AbortRequestAttempt(active_request_.get()); 222 AbortRequestAttempt(active_request_.get());
216 } 223 }
217 224
218 // Stopping offliner means it will not call callback so set last status. 225 // Stopping offliner means it will not call callback so set last status.
219 last_offlining_status_ = stop_status; 226 last_offlining_status_ = stop_status;
220 227
221 if (active_request_) { 228 if (active_request_) {
222 event_logger_.RecordOfflinerResult(active_request_->client_id().name_space, 229 event_logger_.RecordOfflinerResult(active_request_->client_id().name_space,
223 last_offlining_status_, 230 last_offlining_status_,
224 active_request_->request_id()); 231 active_request_->request_id());
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 821
815 ClientPolicyController* RequestCoordinator::GetPolicyController() { 822 ClientPolicyController* RequestCoordinator::GetPolicyController() {
816 return policy_controller_.get(); 823 return policy_controller_.get();
817 } 824 }
818 825
819 void RequestCoordinator::Shutdown() { 826 void RequestCoordinator::Shutdown() {
820 network_quality_estimator_ = nullptr; 827 network_quality_estimator_ = nullptr;
821 } 828 }
822 829
823 } // namespace offline_pages 830 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698