| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 next_handler_->OnBeforeNetworkStart(url, &is_deferred_); | 139 next_handler_->OnBeforeNetworkStart(url, &is_deferred_); |
| 140 *defer = is_deferred_; | 140 *defer = is_deferred_; |
| 141 return ret; | 141 return ret; |
| 142 } | 142 } |
| 143 | 143 |
| 144 bool DetachableResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 144 bool DetachableResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 145 int* buf_size, | 145 int* buf_size, |
| 146 int min_size) { | 146 int min_size) { |
| 147 if (!next_handler_) { | 147 if (!next_handler_) { |
| 148 DCHECK_EQ(-1, min_size); | 148 DCHECK_EQ(-1, min_size); |
| 149 if (!read_buffer_) | 149 if (!read_buffer_.get()) |
| 150 read_buffer_ = new net::IOBuffer(kReadBufSize); | 150 read_buffer_ = new net::IOBuffer(kReadBufSize); |
| 151 *buf = read_buffer_; | 151 *buf = read_buffer_; |
| 152 *buf_size = kReadBufSize; | 152 *buf_size = kReadBufSize; |
| 153 return true; | 153 return true; |
| 154 } | 154 } |
| 155 | 155 |
| 156 return next_handler_->OnWillRead(buf, buf_size, min_size); | 156 return next_handler_->OnWillRead(buf, buf_size, min_size); |
| 157 } | 157 } |
| 158 | 158 |
| 159 bool DetachableResourceHandler::OnReadCompleted(int bytes_read, bool* defer) { | 159 bool DetachableResourceHandler::OnReadCompleted(int bytes_read, bool* defer) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 203 |
| 204 void DetachableResourceHandler::CancelAndIgnore() { | 204 void DetachableResourceHandler::CancelAndIgnore() { |
| 205 controller()->CancelAndIgnore(); | 205 controller()->CancelAndIgnore(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void DetachableResourceHandler::CancelWithError(int error_code) { | 208 void DetachableResourceHandler::CancelWithError(int error_code) { |
| 209 controller()->CancelWithError(error_code); | 209 controller()->CancelWithError(error_code); |
| 210 } | 210 } |
| 211 | 211 |
| 212 } // namespace content | 212 } // namespace content |
| OLD | NEW |