| 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/sync_resource_handler.h" | 5 #include "content/browser/loader/sync_resource_handler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/loader/netlog_observer.h" | 8 #include "content/browser/loader/netlog_observer.h" |
| 9 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 9 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 10 #include "content/browser/loader/resource_message_filter.h" | 10 #include "content/browser/loader/resource_message_filter.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 bool SyncResourceHandler::OnReadCompleted(int bytes_read, bool* defer) { | 107 bool SyncResourceHandler::OnReadCompleted(int bytes_read, bool* defer) { |
| 108 if (!bytes_read) | 108 if (!bytes_read) |
| 109 return true; | 109 return true; |
| 110 result_.data.append(read_buffer_->data(), bytes_read); | 110 result_.data.append(read_buffer_->data(), bytes_read); |
| 111 return true; | 111 return true; |
| 112 } | 112 } |
| 113 | 113 |
| 114 void SyncResourceHandler::OnResponseCompleted( | 114 void SyncResourceHandler::OnResponseCompleted( |
| 115 const net::URLRequestStatus& status, | 115 const net::URLRequestStatus& status, |
| 116 const std::string& security_info, | |
| 117 bool* defer) { | 116 bool* defer) { |
| 118 ResourceMessageFilter* filter = GetFilter(); | 117 ResourceMessageFilter* filter = GetFilter(); |
| 119 if (!filter) | 118 if (!filter) |
| 120 return; | 119 return; |
| 121 | 120 |
| 122 result_.error_code = status.error(); | 121 result_.error_code = status.error(); |
| 123 | 122 |
| 124 int total_transfer_size = request()->GetTotalReceivedBytes(); | 123 int total_transfer_size = request()->GetTotalReceivedBytes(); |
| 125 result_.encoded_data_length = total_transfer_size_ + total_transfer_size; | 124 result_.encoded_data_length = total_transfer_size_ + total_transfer_size; |
| 126 result_.encoded_body_length = request()->GetRawBodyBytes(); | 125 result_.encoded_body_length = request()->GetRawBodyBytes(); |
| 127 | 126 |
| 128 ResourceHostMsg_SyncLoad::WriteReplyParams(result_message_, result_); | 127 ResourceHostMsg_SyncLoad::WriteReplyParams(result_message_, result_); |
| 129 filter->Send(result_message_); | 128 filter->Send(result_message_); |
| 130 result_message_ = NULL; | 129 result_message_ = NULL; |
| 131 return; | 130 return; |
| 132 } | 131 } |
| 133 | 132 |
| 134 void SyncResourceHandler::OnDataDownloaded(int bytes_downloaded) { | 133 void SyncResourceHandler::OnDataDownloaded(int bytes_downloaded) { |
| 135 // Sync requests don't involve ResourceMsg_DataDownloaded messages | 134 // Sync requests don't involve ResourceMsg_DataDownloaded messages |
| 136 // being sent back to renderers as progress is made. | 135 // being sent back to renderers as progress is made. |
| 137 } | 136 } |
| 138 | 137 |
| 139 } // namespace content | 138 } // namespace content |
| OLD | NEW |