| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/async_revalidation_driver.h" | 5 #include "content/browser/loader/async_revalidation_driver.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 AsyncRevalidationDriver::AsyncRevalidationDriver( | 39 AsyncRevalidationDriver::AsyncRevalidationDriver( |
| 40 std::unique_ptr<net::URLRequest> request, | 40 std::unique_ptr<net::URLRequest> request, |
| 41 std::unique_ptr<ResourceThrottle> throttle, | 41 std::unique_ptr<ResourceThrottle> throttle, |
| 42 const base::Closure& completion_callback) | 42 const base::Closure& completion_callback) |
| 43 : request_(std::move(request)), | 43 : request_(std::move(request)), |
| 44 throttle_(std::move(throttle)), | 44 throttle_(std::move(throttle)), |
| 45 completion_callback_(completion_callback), | 45 completion_callback_(completion_callback), |
| 46 weak_ptr_factory_(this) { | 46 weak_ptr_factory_(this) { |
| 47 request_->set_delegate(this); | 47 request_->set_delegate(this); |
| 48 throttle_->set_controller(this); | 48 throttle_->set_delegate(this); |
| 49 } | 49 } |
| 50 | 50 |
| 51 AsyncRevalidationDriver::~AsyncRevalidationDriver() {} | 51 AsyncRevalidationDriver::~AsyncRevalidationDriver() {} |
| 52 | 52 |
| 53 void AsyncRevalidationDriver::StartRequest() { | 53 void AsyncRevalidationDriver::StartRequest() { |
| 54 // Give the handler a chance to delay the URLRequest from being started. | 54 // Give the handler a chance to delay the URLRequest from being started. |
| 55 bool defer_start = false; | 55 bool defer_start = false; |
| 56 throttle_->WillStartRequest(&defer_start); | 56 throttle_->WillStartRequest(&defer_start); |
| 57 | 57 |
| 58 if (defer_start) { | 58 if (defer_start) { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 CancelRequestInternal(net::ERR_TIMED_OUT, result); | 255 CancelRequestInternal(net::ERR_TIMED_OUT, result); |
| 256 } | 256 } |
| 257 | 257 |
| 258 void AsyncRevalidationDriver::RecordDefer() { | 258 void AsyncRevalidationDriver::RecordDefer() { |
| 259 request_->LogBlockedBy(throttle_->GetNameForLogging()); | 259 request_->LogBlockedBy(throttle_->GetNameForLogging()); |
| 260 DCHECK(!is_deferred_); | 260 DCHECK(!is_deferred_); |
| 261 is_deferred_ = true; | 261 is_deferred_ = true; |
| 262 } | 262 } |
| 263 | 263 |
| 264 } // namespace content | 264 } // namespace content |
| OLD | NEW |