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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // document blocking policy. We only do this for the first chunk of data. | 241 // document blocking policy. We only do this for the first chunk of data. |
242 if (request_info->site_isolation_metadata.get()) { | 242 if (request_info->site_isolation_metadata.get()) { |
243 SiteIsolationStatsGatherer::OnReceivedFirstChunk( | 243 SiteIsolationStatsGatherer::OnReceivedFirstChunk( |
244 request_info->site_isolation_metadata, data.data(), data.size()); | 244 request_info->site_isolation_metadata, data.data(), data.size()); |
245 request_info->site_isolation_metadata.reset(); | 245 request_info->site_isolation_metadata.reset(); |
246 } | 246 } |
247 | 247 |
248 DCHECK(!request_info->buffer.get()); | 248 DCHECK(!request_info->buffer.get()); |
249 | 249 |
250 std::unique_ptr<RequestPeer::ReceivedData> received_data( | 250 std::unique_ptr<RequestPeer::ReceivedData> received_data( |
251 new content::FixedReceivedData(data, encoded_data_length)); | 251 new content::FixedReceivedData(data, encoded_data_length, |
| 252 encoded_body_length)); |
252 request_info->peer->OnReceivedData(std::move(received_data)); | 253 request_info->peer->OnReceivedData(std::move(received_data)); |
253 } | 254 } |
254 | 255 |
255 void ResourceDispatcher::OnReceivedData(int request_id, | 256 void ResourceDispatcher::OnReceivedData(int request_id, |
256 int data_offset, | 257 int data_offset, |
257 int data_length, | 258 int data_length, |
258 int encoded_data_length, | 259 int encoded_data_length, |
259 int encoded_body_length) { | 260 int encoded_body_length) { |
260 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedData"); | 261 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedData"); |
261 DCHECK_GT(data_length, 0); | 262 DCHECK_GT(data_length, 0); |
(...skipping 10 matching lines...) Expand all Loading... |
272 | 273 |
273 // Check whether this response data is compliant with our cross-site | 274 // Check whether this response data is compliant with our cross-site |
274 // document blocking policy. We only do this for the first chunk of data. | 275 // document blocking policy. We only do this for the first chunk of data. |
275 if (request_info->site_isolation_metadata.get()) { | 276 if (request_info->site_isolation_metadata.get()) { |
276 SiteIsolationStatsGatherer::OnReceivedFirstChunk( | 277 SiteIsolationStatsGatherer::OnReceivedFirstChunk( |
277 request_info->site_isolation_metadata, data_ptr, data_length); | 278 request_info->site_isolation_metadata, data_ptr, data_length); |
278 request_info->site_isolation_metadata.reset(); | 279 request_info->site_isolation_metadata.reset(); |
279 } | 280 } |
280 | 281 |
281 std::unique_ptr<RequestPeer::ReceivedData> data = | 282 std::unique_ptr<RequestPeer::ReceivedData> data = |
282 request_info->received_data_factory->Create(data_offset, data_length, | 283 request_info->received_data_factory->Create( |
283 encoded_data_length); | 284 data_offset, data_length, encoded_data_length, encoded_body_length); |
284 // |data| takes care of ACKing. | 285 // |data| takes care of ACKing. |
285 send_ack = false; | 286 send_ack = false; |
286 request_info->peer->OnReceivedData(std::move(data)); | 287 request_info->peer->OnReceivedData(std::move(data)); |
287 } | 288 } |
288 | 289 |
289 // Acknowledge the reception of this data. | 290 // Acknowledge the reception of this data. |
290 if (send_ack) | 291 if (send_ack) |
291 message_sender_->Send(new ResourceHostMsg_DataReceived_ACK(request_id)); | 292 message_sender_->Send(new ResourceHostMsg_DataReceived_ACK(request_id)); |
292 } | 293 } |
293 | 294 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 response->mime_type = result.mime_type; | 567 response->mime_type = result.mime_type; |
567 response->charset = result.charset; | 568 response->charset = result.charset; |
568 response->request_time = result.request_time; | 569 response->request_time = result.request_time; |
569 response->response_time = result.response_time; | 570 response->response_time = result.response_time; |
570 response->encoded_data_length = result.encoded_data_length; | 571 response->encoded_data_length = result.encoded_data_length; |
571 response->load_timing = result.load_timing; | 572 response->load_timing = result.load_timing; |
572 response->devtools_info = result.devtools_info; | 573 response->devtools_info = result.devtools_info; |
573 response->data.swap(result.data); | 574 response->data.swap(result.data); |
574 response->download_file_path = result.download_file_path; | 575 response->download_file_path = result.download_file_path; |
575 response->socket_address = result.socket_address; | 576 response->socket_address = result.socket_address; |
| 577 response->encoded_body_length = result.encoded_body_length; |
576 } | 578 } |
577 | 579 |
578 int ResourceDispatcher::StartAsync(const RequestInfo& request_info, | 580 int ResourceDispatcher::StartAsync(const RequestInfo& request_info, |
579 ResourceRequestBodyImpl* request_body, | 581 ResourceRequestBodyImpl* request_body, |
580 std::unique_ptr<RequestPeer> peer) { | 582 std::unique_ptr<RequestPeer> peer) { |
581 GURL frame_origin; | 583 GURL frame_origin; |
582 std::unique_ptr<ResourceRequest> request = | 584 std::unique_ptr<ResourceRequest> request = |
583 CreateRequest(request_info, request_body, &frame_origin); | 585 CreateRequest(request_info, request_body, &frame_origin); |
584 | 586 |
585 // Compute a unique request_id for this renderer process. | 587 // Compute a unique request_id for this renderer process. |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 *frame_origin = extra_data->frame_origin(); | 812 *frame_origin = extra_data->frame_origin(); |
811 return request; | 813 return request; |
812 } | 814 } |
813 | 815 |
814 void ResourceDispatcher::SetResourceSchedulingFilter( | 816 void ResourceDispatcher::SetResourceSchedulingFilter( |
815 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { | 817 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { |
816 resource_scheduling_filter_ = resource_scheduling_filter; | 818 resource_scheduling_filter_ = resource_scheduling_filter; |
817 } | 819 } |
818 | 820 |
819 } // namespace content | 821 } // namespace content |
OLD | NEW |