| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/download_throttling_resource_handler.h" | 5 #include "chrome/browser/renderer_host/download_throttling_resource_handler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/renderer_host/download_resource_handler.h" | 8 #include "chrome/browser/renderer_host/download_resource_handler.h" |
| 9 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 9 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| 10 | 11 |
| 11 DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler( | 12 DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler( |
| 12 ResourceDispatcherHost* host, | 13 ResourceDispatcherHost* host, |
| 13 URLRequest* request, | 14 URLRequest* request, |
| 14 const GURL& url, | 15 const GURL& url, |
| 15 int render_process_host_id, | 16 int render_process_host_id, |
| 16 int render_view_id, | 17 int render_view_id, |
| 17 int request_id, | 18 int request_id, |
| 18 bool in_complete) | 19 bool in_complete) |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 int buf_size; | 159 int buf_size; |
| 159 if (download_handler_->OnWillRead(request_id_, &buffer, &buf_size, | 160 if (download_handler_->OnWillRead(request_id_, &buffer, &buf_size, |
| 160 tmp_buffer_length_)) { | 161 tmp_buffer_length_)) { |
| 161 CHECK(buf_size >= tmp_buffer_length_); | 162 CHECK(buf_size >= tmp_buffer_length_); |
| 162 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_); | 163 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_); |
| 163 download_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_); | 164 download_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_); |
| 164 } | 165 } |
| 165 tmp_buffer_length_ = 0; | 166 tmp_buffer_length_ = 0; |
| 166 tmp_buffer_ = NULL; | 167 tmp_buffer_ = NULL; |
| 167 } | 168 } |
| OLD | NEW |