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

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

Issue 2071403003: Revises RequestCoordinator to not try to schedule another request when previous one fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months 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 <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
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
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