| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/child/url_loader_client_impl.h" | 5 #include "content/child/url_loader_client_impl.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "content/child/resource_dispatcher.h" | 9 #include "content/child/resource_dispatcher.h" |
| 10 #include "content/child/url_response_body_consumer.h" | 10 #include "content/child/url_response_body_consumer.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 StoreAndDispatch( | 139 StoreAndDispatch( |
| 140 ResourceMsg_DataDownloaded(request_id_, data_len, encoded_data_len)); | 140 ResourceMsg_DataDownloaded(request_id_, data_len, encoded_data_len)); |
| 141 } else { | 141 } else { |
| 142 resource_dispatcher_->OnDownloadedData(request_id_, data_len, | 142 resource_dispatcher_->OnDownloadedData(request_id_, data_len, |
| 143 encoded_data_len); | 143 encoded_data_len); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 void URLLoaderClientImpl::OnReceiveCachedMetadata( | 147 void URLLoaderClientImpl::OnReceiveCachedMetadata( |
| 148 const std::vector<uint8_t>& data) { | 148 const std::vector<uint8_t>& data) { |
| 149 const uint8_t* data_ptr = reinterpret_cast<const uint8_t*>(data.data()); | |
| 150 std::vector<char> data_to_pass(data_ptr, data_ptr + data.size()); | |
| 151 if (NeedsStoringMessage()) { | 149 if (NeedsStoringMessage()) { |
| 152 StoreAndDispatch( | 150 StoreAndDispatch(ResourceMsg_ReceivedCachedMetadata(request_id_, data)); |
| 153 ResourceMsg_ReceivedCachedMetadata(request_id_, data_to_pass)); | |
| 154 } else { | 151 } else { |
| 155 resource_dispatcher_->OnReceivedCachedMetadata(request_id_, data_to_pass); | 152 resource_dispatcher_->OnReceivedCachedMetadata(request_id_, data); |
| 156 } | 153 } |
| 157 } | 154 } |
| 158 | 155 |
| 159 void URLLoaderClientImpl::OnTransferSizeUpdated(int32_t transfer_size_diff) { | 156 void URLLoaderClientImpl::OnTransferSizeUpdated(int32_t transfer_size_diff) { |
| 160 if (is_deferred_) { | 157 if (is_deferred_) { |
| 161 accumulated_transfer_size_diff_during_deferred_ += transfer_size_diff; | 158 accumulated_transfer_size_diff_during_deferred_ += transfer_size_diff; |
| 162 } else { | 159 } else { |
| 163 resource_dispatcher_->OnTransferSizeUpdated(request_id_, | 160 resource_dispatcher_->OnTransferSizeUpdated(request_id_, |
| 164 transfer_size_diff); | 161 transfer_size_diff); |
| 165 } | 162 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 StoreAndDispatch( | 208 StoreAndDispatch( |
| 212 ResourceMsg_UploadProgress(request_id_, current_position, total_size)); | 209 ResourceMsg_UploadProgress(request_id_, current_position, total_size)); |
| 213 } else { | 210 } else { |
| 214 resource_dispatcher_->OnUploadProgress(request_id_, current_position, | 211 resource_dispatcher_->OnUploadProgress(request_id_, current_position, |
| 215 total_size); | 212 total_size); |
| 216 } | 213 } |
| 217 ack_callback.Run(); | 214 ack_callback.Run(); |
| 218 } | 215 } |
| 219 | 216 |
| 220 } // namespace content | 217 } // namespace content |
| OLD | NEW |