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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading |
6 | 6 |
7 #include "content/child/resource_dispatcher.h" | 7 #include "content/child/resource_dispatcher.h" |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 DCHECK(!body_consumer_); | 107 DCHECK(!body_consumer_); |
108 resource_dispatcher_->OnMessageReceived(ResourceMsg_ReceivedRedirect( | 108 resource_dispatcher_->OnMessageReceived(ResourceMsg_ReceivedRedirect( |
109 request_id_, redirect_info, response_head)); | 109 request_id_, redirect_info, response_head)); |
110 } | 110 } |
111 | 111 |
112 void OnDataDownloaded(int64_t data_len, int64_t encoded_data_len) override { | 112 void OnDataDownloaded(int64_t data_len, int64_t encoded_data_len) override { |
113 resource_dispatcher_->OnMessageReceived( | 113 resource_dispatcher_->OnMessageReceived( |
114 ResourceMsg_DataDownloaded(request_id_, data_len, encoded_data_len)); | 114 ResourceMsg_DataDownloaded(request_id_, data_len, encoded_data_len)); |
115 } | 115 } |
116 | 116 |
117 void OnUploadProgress(int64_t current_position, | |
118 int64_t total_size, | |
119 const base::Closure& ack_callback) override { | |
120 resource_dispatcher_->OnMessageReceived( | |
121 ResourceMsg_UploadProgress(request_id_, current_position, total_size)); | |
122 ack_callback.Run(); | |
123 } | |
124 | |
117 void OnStartLoadingResponseBody( | 125 void OnStartLoadingResponseBody( |
118 mojo::ScopedDataPipeConsumerHandle body) override { | 126 mojo::ScopedDataPipeConsumerHandle body) override { |
119 DCHECK(!body_consumer_); | 127 DCHECK(!body_consumer_); |
120 body_consumer_ = new URLResponseBodyConsumer( | 128 body_consumer_ = new URLResponseBodyConsumer( |
121 request_id_, resource_dispatcher_, std::move(body), task_runner_); | 129 request_id_, resource_dispatcher_, std::move(body), task_runner_); |
122 if (has_received_response_) | 130 if (has_received_response_) |
123 body_consumer_->Start(); | 131 body_consumer_->Start(); |
124 } | 132 } |
125 | 133 |
126 void OnComplete(const ResourceRequestCompletionStatus& status) override { | 134 void OnComplete(const ResourceRequestCompletionStatus& status) override { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 | 231 |
224 void ResourceDispatcher::OnUploadProgress(int request_id, | 232 void ResourceDispatcher::OnUploadProgress(int request_id, |
225 int64_t position, | 233 int64_t position, |
226 int64_t size) { | 234 int64_t size) { |
227 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 235 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
228 if (!request_info) | 236 if (!request_info) |
229 return; | 237 return; |
230 | 238 |
231 request_info->peer->OnUploadProgress(position, size); | 239 request_info->peer->OnUploadProgress(position, size); |
232 | 240 |
233 // Acknowledge receipt | 241 if (!request_info->url_loader) { |
yhirano
2016/12/16 08:47:56
Please leave some comments here.
tzik
2017/01/05 05:14:33
Done.
| |
234 message_sender_->Send(new ResourceHostMsg_UploadProgress_ACK(request_id)); | 242 // Acknowledge receipt |
243 message_sender_->Send(new ResourceHostMsg_UploadProgress_ACK(request_id)); | |
244 } | |
235 } | 245 } |
236 | 246 |
237 void ResourceDispatcher::OnReceivedResponse( | 247 void ResourceDispatcher::OnReceivedResponse( |
238 int request_id, const ResourceResponseHead& response_head) { | 248 int request_id, const ResourceResponseHead& response_head) { |
239 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedResponse"); | 249 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedResponse"); |
240 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 250 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
241 if (!request_info) | 251 if (!request_info) |
242 return; | 252 return; |
243 request_info->response_start = ConsumeIOTimestamp(); | 253 request_info->response_start = ConsumeIOTimestamp(); |
244 | 254 |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
861 delete message; | 871 delete message; |
862 } | 872 } |
863 } | 873 } |
864 | 874 |
865 void ResourceDispatcher::SetResourceSchedulingFilter( | 875 void ResourceDispatcher::SetResourceSchedulingFilter( |
866 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { | 876 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { |
867 resource_scheduling_filter_ = resource_scheduling_filter; | 877 resource_scheduling_filter_ = resource_scheduling_filter; |
868 } | 878 } |
869 | 879 |
870 } // namespace content | 880 } // namespace content |
OLD | NEW |