Chromium Code Reviews| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 DCHECK(!body_consumer_); | 127 DCHECK(!body_consumer_); |
| 128 Dispatch( | 128 Dispatch( |
| 129 ResourceMsg_ReceivedRedirect(request_id_, redirect_info, response_head)); | 129 ResourceMsg_ReceivedRedirect(request_id_, redirect_info, response_head)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void URLLoaderClientImpl::OnDataDownloaded(int64_t data_len, | 132 void URLLoaderClientImpl::OnDataDownloaded(int64_t data_len, |
| 133 int64_t encoded_data_len) { | 133 int64_t encoded_data_len) { |
| 134 Dispatch(ResourceMsg_DataDownloaded(request_id_, data_len, encoded_data_len)); | 134 Dispatch(ResourceMsg_DataDownloaded(request_id_, data_len, encoded_data_len)); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void URLLoaderClientImpl::OnReceiveCachedMetadata( | |
| 138 const std::vector<uint8_t>& data) { | |
| 139 const char* ptr = reinterpret_cast<const char*>(data.data()); | |
|
mmenke
2017/01/17 18:39:57
Again, suggest replacing ptr with data
yhirano
2017/01/18 06:22:42
I'm using data_ptr as we are already using the nam
| |
| 140 Dispatch(ResourceMsg_ReceivedCachedMetadata( | |
| 141 request_id_, std::vector<char>(ptr, ptr + data.size()))); | |
|
dcheng
2017/01/14 11:30:17
And I guess this is another copy =(
Is there any
yhirano
2017/01/16 05:25:46
This is needed to reuse the current ResourceDispat
dcheng
2017/01/18 00:23:53
Sort of... we have to reinterpret_cast the origina
yhirano
2017/01/18 06:22:42
Acknowledged.
| |
| 142 } | |
| 143 | |
| 137 void URLLoaderClientImpl::OnTransferSizeUpdated(int32_t transfer_size_diff) { | 144 void URLLoaderClientImpl::OnTransferSizeUpdated(int32_t transfer_size_diff) { |
| 138 if (is_deferred_) { | 145 if (is_deferred_) { |
| 139 accumulated_transfer_size_diff_during_deferred_ += transfer_size_diff; | 146 accumulated_transfer_size_diff_during_deferred_ += transfer_size_diff; |
| 140 } else { | 147 } else { |
| 141 resource_dispatcher_->OnTransferSizeUpdated(request_id_, | 148 resource_dispatcher_->OnTransferSizeUpdated(request_id_, |
| 142 transfer_size_diff); | 149 transfer_size_diff); |
| 143 } | 150 } |
| 144 } | 151 } |
| 145 | 152 |
| 146 void URLLoaderClientImpl::OnStartLoadingResponseBody( | 153 void URLLoaderClientImpl::OnStartLoadingResponseBody( |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 168 deferred_messages_.push_back(message); | 175 deferred_messages_.push_back(message); |
| 169 } else if (deferred_messages_.size() > 0) { | 176 } else if (deferred_messages_.size() > 0) { |
| 170 deferred_messages_.push_back(message); | 177 deferred_messages_.push_back(message); |
| 171 FlushDeferredMessages(); | 178 FlushDeferredMessages(); |
| 172 } else { | 179 } else { |
| 173 resource_dispatcher_->DispatchMessage(message); | 180 resource_dispatcher_->DispatchMessage(message); |
| 174 } | 181 } |
| 175 } | 182 } |
| 176 | 183 |
| 177 } // namespace content | 184 } // namespace content |
| OLD | NEW |