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

Side by Side Diff: content/browser/loader/detachable_resource_handler.cc

Issue 2673453002: Fix DetachableResourceHandler when OnResponseCompleted is deferred. (Closed)
Patch Set: Created 3 years, 10 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/loader/detachable_resource_handler.h" 5 #include "content/browser/loader/detachable_resource_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // No DCHECK(!is_deferred_) as the request may have been cancelled while 219 // No DCHECK(!is_deferred_) as the request may have been cancelled while
220 // deferred. 220 // deferred.
221 221
222 if (!next_handler_) { 222 if (!next_handler_) {
223 controller->Resume(); 223 controller->Resume();
224 return; 224 return;
225 } 225 }
226 226
227 is_finished_ = true; 227 is_finished_ = true;
228 228
229 next_handler_->OnResponseCompleted(status, std::move(controller)); 229 HoldController(std::move(controller));
230 next_handler_->OnResponseCompleted(status,
231 base::MakeUnique<Controller>(this));
230 } 232 }
231 233
232 void DetachableResourceHandler::OnDataDownloaded(int bytes_downloaded) { 234 void DetachableResourceHandler::OnDataDownloaded(int bytes_downloaded) {
233 if (!next_handler_) 235 if (!next_handler_)
234 return; 236 return;
235 237
236 next_handler_->OnDataDownloaded(bytes_downloaded); 238 next_handler_->OnDataDownloaded(bytes_downloaded);
237 } 239 }
238 240
239 void DetachableResourceHandler::OnTimedOut() { 241 void DetachableResourceHandler::OnTimedOut() {
240 // Requests are only timed out after being detached, and shouldn't be deferred 242 // Requests are only timed out after being detached, and shouldn't be deferred
241 // once detached. 243 // once detached.
242 DCHECK(!next_handler_); 244 DCHECK(!next_handler_);
243 DCHECK(!has_controller()); 245 DCHECK(!has_controller());
244 246
245 OutOfBandCancel(net::ERR_ABORTED, true /* tell_renderer */); 247 OutOfBandCancel(net::ERR_ABORTED, true /* tell_renderer */);
246 } 248 }
247 249
248 } // namespace content 250 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698