| 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/buffered_resource_handler.h" | 5 #include "content/browser/loader/buffered_resource_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 request()->url(), GURL(), response_->head.mime_type, allow_wildcard, | 452 request()->url(), GURL(), response_->head.mime_type, allow_wildcard, |
| 453 stale, &plugin, NULL); | 453 stale, &plugin, NULL); |
| 454 #else | 454 #else |
| 455 if (stale) | 455 if (stale) |
| 456 *stale = false; | 456 *stale = false; |
| 457 return false; | 457 return false; |
| 458 #endif | 458 #endif |
| 459 } | 459 } |
| 460 | 460 |
| 461 bool BufferedResourceHandler::CopyReadBufferToNextHandler(int request_id) { | 461 bool BufferedResourceHandler::CopyReadBufferToNextHandler(int request_id) { |
| 462 if (!bytes_read_) | 462 if (!read_buffer_.get()) |
| 463 return true; | 463 return true; |
| 464 | 464 |
| 465 scoped_refptr<net::IOBuffer> buf; | 465 scoped_refptr<net::IOBuffer> buf; |
| 466 int buf_len = 0; | 466 int buf_len = 0; |
| 467 if (!next_handler_->OnWillRead(request_id, &buf, &buf_len, bytes_read_)) | 467 if (!next_handler_->OnWillRead(request_id, &buf, &buf_len, bytes_read_)) |
| 468 return false; | 468 return false; |
| 469 | 469 |
| 470 CHECK((buf_len >= bytes_read_) && (bytes_read_ >= 0)); | 470 CHECK((buf_len >= bytes_read_) && (bytes_read_ >= 0)); |
| 471 memcpy(buf->data(), read_buffer_->data(), bytes_read_); | 471 memcpy(buf->data(), read_buffer_->data(), bytes_read_); |
| 472 return true; | 472 return true; |
| 473 } | 473 } |
| 474 | 474 |
| 475 void BufferedResourceHandler::OnPluginsLoaded( | 475 void BufferedResourceHandler::OnPluginsLoaded( |
| 476 const std::vector<WebPluginInfo>& plugins) { | 476 const std::vector<WebPluginInfo>& plugins) { |
| 477 request()->LogUnblocked(); | 477 request()->LogUnblocked(); |
| 478 bool defer = false; | 478 bool defer = false; |
| 479 if (!ProcessResponse(&defer)) { | 479 if (!ProcessResponse(&defer)) { |
| 480 controller()->Cancel(); | 480 controller()->Cancel(); |
| 481 } else if (!defer) { | 481 } else if (!defer) { |
| 482 controller()->Resume(); | 482 controller()->Resume(); |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 | 485 |
| 486 } // namespace content | 486 } // namespace content |
| OLD | NEW |