| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mime_sniffing_resource_handler.h" | 5 #include "content/browser/loader/mime_sniffing_resource_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 response_->head.mime_type == "application/atom+xml") { | 209 response_->head.mime_type == "application/atom+xml") { |
| 210 response_->head.mime_type.assign("text/plain"); | 210 response_->head.mime_type.assign("text/plain"); |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 | 213 |
| 214 HoldController(std::move(controller)); | 214 HoldController(std::move(controller)); |
| 215 AdvanceState(); | 215 AdvanceState(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 bool MimeSniffingResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 218 bool MimeSniffingResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 219 int* buf_size, | 219 int* buf_size) { |
| 220 int min_size) { | |
| 221 if (state_ == STATE_STREAMING) | 220 if (state_ == STATE_STREAMING) |
| 222 return next_handler_->OnWillRead(buf, buf_size, min_size); | 221 return next_handler_->OnWillRead(buf, buf_size); |
| 223 | |
| 224 DCHECK_EQ(-1, min_size); | |
| 225 | 222 |
| 226 if (read_buffer_.get()) { | 223 if (read_buffer_.get()) { |
| 227 CHECK_LT(bytes_read_, read_buffer_size_); | 224 CHECK_LT(bytes_read_, read_buffer_size_); |
| 228 *buf = new DependentIOBuffer(read_buffer_.get(), bytes_read_); | 225 *buf = new DependentIOBuffer(read_buffer_.get(), bytes_read_); |
| 229 *buf_size = read_buffer_size_ - bytes_read_; | 226 *buf_size = read_buffer_size_ - bytes_read_; |
| 230 } else { | 227 } else { |
| 231 if (!next_handler_->OnWillRead(buf, buf_size, min_size)) | 228 if (!next_handler_->OnWillRead(buf, buf_size)) |
| 232 return false; | 229 return false; |
| 233 | 230 |
| 234 read_buffer_ = *buf; | 231 read_buffer_ = *buf; |
| 235 read_buffer_size_ = *buf_size; | 232 read_buffer_size_ = *buf_size; |
| 236 DCHECK_GE(read_buffer_size_, net::kMaxBytesToSniff * 2); | 233 DCHECK_GE(read_buffer_size_, net::kMaxBytesToSniff * 2); |
| 237 } | 234 } |
| 238 return true; | 235 return true; |
| 239 } | 236 } |
| 240 | 237 |
| 241 void MimeSniffingResourceHandler::OnReadCompleted( | 238 void MimeSniffingResourceHandler::OnReadCompleted( |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 | 555 |
| 559 void MimeSniffingResourceHandler::OnPluginsLoaded( | 556 void MimeSniffingResourceHandler::OnPluginsLoaded( |
| 560 const std::vector<WebPluginInfo>& plugins) { | 557 const std::vector<WebPluginInfo>& plugins) { |
| 561 // No longer blocking on the plugins being loaded. | 558 // No longer blocking on the plugins being loaded. |
| 562 request()->LogUnblocked(); | 559 request()->LogUnblocked(); |
| 563 if (state_ == STATE_BUFFERING) | 560 if (state_ == STATE_BUFFERING) |
| 564 AdvanceState(); | 561 AdvanceState(); |
| 565 } | 562 } |
| 566 | 563 |
| 567 } // namespace content | 564 } // namespace content |
| OLD | NEW |