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 OnTransferSizeUpdated(int64_t transfer_size_diff) override { | |
118 resource_dispatcher_->OnTransferSizeUpdated(request_id_, | |
119 transfer_size_diff); | |
120 } | |
121 | |
117 void OnStartLoadingResponseBody( | 122 void OnStartLoadingResponseBody( |
118 mojo::ScopedDataPipeConsumerHandle body) override { | 123 mojo::ScopedDataPipeConsumerHandle body) override { |
119 DCHECK(!body_consumer_); | 124 DCHECK(!body_consumer_); |
120 body_consumer_ = new URLResponseBodyConsumer( | 125 body_consumer_ = new URLResponseBodyConsumer( |
121 request_id_, resource_dispatcher_, std::move(body), task_runner_); | 126 request_id_, resource_dispatcher_, std::move(body), task_runner_); |
122 if (has_received_response_) | 127 if (has_received_response_) |
123 body_consumer_->Start(task_runner_.get()); | 128 body_consumer_->Start(task_runner_.get()); |
124 } | 129 } |
125 | 130 |
126 void OnComplete(const ResourceRequestCompletionStatus& status) override { | 131 void OnComplete(const ResourceRequestCompletionStatus& status) override { |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
569 } | 574 } |
570 | 575 |
571 void ResourceDispatcher::DidChangePriority(int request_id, | 576 void ResourceDispatcher::DidChangePriority(int request_id, |
572 net::RequestPriority new_priority, | 577 net::RequestPriority new_priority, |
573 int intra_priority_value) { | 578 int intra_priority_value) { |
574 DCHECK(base::ContainsKey(pending_requests_, request_id)); | 579 DCHECK(base::ContainsKey(pending_requests_, request_id)); |
575 message_sender_->Send(new ResourceHostMsg_DidChangePriority( | 580 message_sender_->Send(new ResourceHostMsg_DidChangePriority( |
576 request_id, new_priority, intra_priority_value)); | 581 request_id, new_priority, intra_priority_value)); |
577 } | 582 } |
578 | 583 |
584 void ResourceDispatcher::OnTransferSizeUpdated(int request_id, | |
585 int transfer_size_diff) { | |
dcheng
2016/12/15 06:29:02
Can we use int64_t or int uniformly? It seems like
yhirano
2016/12/15 11:28:00
I added a TODO comment.
| |
586 DCHECK_GT(transfer_size_diff, 0); | |
587 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | |
dcheng
2016/12/15 06:29:02
Unrelated, but I wish this class used GetPendingRe
yhirano
2016/12/15 11:28:00
There are four pending_request_.find() in this fil
| |
588 if (!request_info) | |
589 return; | |
590 | |
591 request_info->peer->OnTransferSizeUpdated(transfer_size_diff); | |
592 } | |
593 | |
579 ResourceDispatcher::PendingRequestInfo::PendingRequestInfo( | 594 ResourceDispatcher::PendingRequestInfo::PendingRequestInfo( |
580 std::unique_ptr<RequestPeer> peer, | 595 std::unique_ptr<RequestPeer> peer, |
581 ResourceType resource_type, | 596 ResourceType resource_type, |
582 int origin_pid, | 597 int origin_pid, |
583 const url::Origin& frame_origin, | 598 const url::Origin& frame_origin, |
584 const GURL& request_url, | 599 const GURL& request_url, |
585 bool download_to_file) | 600 bool download_to_file) |
586 : peer(std::move(peer)), | 601 : peer(std::move(peer)), |
587 resource_type(resource_type), | 602 resource_type(resource_type), |
588 origin_pid(origin_pid), | 603 origin_pid(origin_pid), |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
861 delete message; | 876 delete message; |
862 } | 877 } |
863 } | 878 } |
864 | 879 |
865 void ResourceDispatcher::SetResourceSchedulingFilter( | 880 void ResourceDispatcher::SetResourceSchedulingFilter( |
866 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { | 881 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { |
867 resource_scheduling_filter_ = resource_scheduling_filter; | 882 resource_scheduling_filter_ = resource_scheduling_filter; |
868 } | 883 } |
869 | 884 |
870 } // namespace content | 885 } // namespace content |
OLD | NEW |