| OLD | NEW |
| 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/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 DCHECK(!is_deferred_); | 121 DCHECK(!is_deferred_); |
| 122 | 122 |
| 123 if (!next_handler_) | 123 if (!next_handler_) |
| 124 return true; | 124 return true; |
| 125 | 125 |
| 126 bool ret = next_handler_->OnWillStart(url, &is_deferred_); | 126 bool ret = next_handler_->OnWillStart(url, &is_deferred_); |
| 127 *defer = is_deferred_; | 127 *defer = is_deferred_; |
| 128 return ret; | 128 return ret; |
| 129 } | 129 } |
| 130 | 130 |
| 131 bool DetachableResourceHandler::OnBeforeNetworkStart(const GURL& url, | |
| 132 bool* defer) { | |
| 133 DCHECK(!is_deferred_); | |
| 134 | |
| 135 if (!next_handler_) | |
| 136 return true; | |
| 137 | |
| 138 bool ret = | |
| 139 next_handler_->OnBeforeNetworkStart(url, &is_deferred_); | |
| 140 *defer = is_deferred_; | |
| 141 return ret; | |
| 142 } | |
| 143 | |
| 144 bool DetachableResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 131 bool DetachableResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 145 int* buf_size, | 132 int* buf_size, |
| 146 int min_size) { | 133 int min_size) { |
| 147 if (!next_handler_) { | 134 if (!next_handler_) { |
| 148 DCHECK_EQ(-1, min_size); | 135 DCHECK_EQ(-1, min_size); |
| 149 if (!read_buffer_.get()) | 136 if (!read_buffer_.get()) |
| 150 read_buffer_ = new net::IOBuffer(kReadBufSize); | 137 read_buffer_ = new net::IOBuffer(kReadBufSize); |
| 151 *buf = read_buffer_; | 138 *buf = read_buffer_; |
| 152 *buf_size = kReadBufSize; | 139 *buf_size = kReadBufSize; |
| 153 return true; | 140 return true; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 190 |
| 204 void DetachableResourceHandler::CancelAndIgnore() { | 191 void DetachableResourceHandler::CancelAndIgnore() { |
| 205 controller()->CancelAndIgnore(); | 192 controller()->CancelAndIgnore(); |
| 206 } | 193 } |
| 207 | 194 |
| 208 void DetachableResourceHandler::CancelWithError(int error_code) { | 195 void DetachableResourceHandler::CancelWithError(int error_code) { |
| 209 controller()->CancelWithError(error_code); | 196 controller()->CancelWithError(error_code); |
| 210 } | 197 } |
| 211 | 198 |
| 212 } // namespace content | 199 } // namespace content |
| OLD | NEW |