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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "content/browser/loader/resource_request_info_impl.h" | 9 #include "content/browser/loader/resource_request_info_impl.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 DCHECK(!is_deferred_); | 126 DCHECK(!is_deferred_); |
127 | 127 |
128 if (!next_handler_) | 128 if (!next_handler_) |
129 return true; | 129 return true; |
130 | 130 |
131 bool ret = next_handler_->OnWillStart(request_id, url, &is_deferred_); | 131 bool ret = next_handler_->OnWillStart(request_id, url, &is_deferred_); |
132 *defer = is_deferred_; | 132 *defer = is_deferred_; |
133 return ret; | 133 return ret; |
134 } | 134 } |
135 | 135 |
| 136 bool DetachableResourceHandler::OnBeforeNetworkStart(int request_id, |
| 137 const GURL& url, |
| 138 bool* defer) { |
| 139 DCHECK(!is_deferred_); |
| 140 |
| 141 if (!next_handler_) |
| 142 return true; |
| 143 |
| 144 bool ret = |
| 145 next_handler_->OnBeforeNetworkStart(request_id, url, &is_deferred_); |
| 146 *defer = is_deferred_; |
| 147 return ret; |
| 148 } |
| 149 |
136 bool DetachableResourceHandler::OnWillRead(int request_id, | 150 bool DetachableResourceHandler::OnWillRead(int request_id, |
137 scoped_refptr<net::IOBuffer>* buf, | 151 scoped_refptr<net::IOBuffer>* buf, |
138 int* buf_size, | 152 int* buf_size, |
139 int min_size) { | 153 int min_size) { |
140 if (!next_handler_) { | 154 if (!next_handler_) { |
141 DCHECK_EQ(-1, min_size); | 155 DCHECK_EQ(-1, min_size); |
142 if (!read_buffer_) | 156 if (!read_buffer_) |
143 read_buffer_ = new net::IOBuffer(kReadBufSize); | 157 read_buffer_ = new net::IOBuffer(kReadBufSize); |
144 *buf = read_buffer_; | 158 *buf = read_buffer_; |
145 *buf_size = kReadBufSize; | 159 *buf_size = kReadBufSize; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 214 |
201 void DetachableResourceHandler::CancelAndIgnore() { | 215 void DetachableResourceHandler::CancelAndIgnore() { |
202 controller()->CancelAndIgnore(); | 216 controller()->CancelAndIgnore(); |
203 } | 217 } |
204 | 218 |
205 void DetachableResourceHandler::CancelWithError(int error_code) { | 219 void DetachableResourceHandler::CancelWithError(int error_code) { |
206 controller()->CancelWithError(error_code); | 220 controller()->CancelWithError(error_code); |
207 } | 221 } |
208 | 222 |
209 } // namespace content | 223 } // namespace content |
OLD | NEW |