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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 return; | 173 return; |
174 request_info->response_start = ConsumeIOTimestamp(); | 174 request_info->response_start = ConsumeIOTimestamp(); |
175 | 175 |
176 if (delegate_) { | 176 if (delegate_) { |
177 std::unique_ptr<RequestPeer> new_peer = delegate_->OnReceivedResponse( | 177 std::unique_ptr<RequestPeer> new_peer = delegate_->OnReceivedResponse( |
178 std::move(request_info->peer), response_head.mime_type, | 178 std::move(request_info->peer), response_head.mime_type, |
179 request_info->url); | 179 request_info->url); |
180 DCHECK(new_peer); | 180 DCHECK(new_peer); |
181 request_info->peer = std::move(new_peer); | 181 request_info->peer = std::move(new_peer); |
182 } | 182 } |
183 | |
184 ResourceResponseInfo renderer_response_info; | 183 ResourceResponseInfo renderer_response_info; |
185 ToResourceResponseInfo(*request_info, response_head, &renderer_response_info); | 184 ToResourceResponseInfo(*request_info, response_head, &renderer_response_info); |
186 request_info->site_isolation_metadata = | 185 request_info->site_isolation_metadata = |
187 SiteIsolationStatsGatherer::OnReceivedResponse( | 186 SiteIsolationStatsGatherer::OnReceivedResponse( |
188 request_info->frame_origin, request_info->response_url, | 187 request_info->frame_origin, request_info->response_url, |
189 request_info->resource_type, request_info->origin_pid, | 188 request_info->resource_type, request_info->origin_pid, |
190 renderer_response_info); | 189 renderer_response_info); |
| 190 renderer_response_info.response_start = response_head.response_start; |
191 request_info->peer->OnReceivedResponse(renderer_response_info); | 191 request_info->peer->OnReceivedResponse(renderer_response_info); |
192 } | 192 } |
193 | 193 |
194 void ResourceDispatcher::OnReceivedCachedMetadata( | 194 void ResourceDispatcher::OnReceivedCachedMetadata( |
195 int request_id, const std::vector<char>& data) { | 195 int request_id, const std::vector<char>& data) { |
196 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 196 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
197 if (!request_info) | 197 if (!request_info) |
198 return; | 198 return; |
199 | 199 |
200 if (data.size()) | 200 if (data.size()) |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 // Compute a unique request_id for this renderer process. | 661 // Compute a unique request_id for this renderer process. |
662 int request_id = MakeRequestID(); | 662 int request_id = MakeRequestID(); |
663 pending_requests_[request_id] = base::MakeUnique<PendingRequestInfo>( | 663 pending_requests_[request_id] = base::MakeUnique<PendingRequestInfo>( |
664 std::move(peer), request->resource_type, request->origin_pid, | 664 std::move(peer), request->resource_type, request->origin_pid, |
665 frame_origin, request->url, request->download_to_file); | 665 frame_origin, request->url, request->download_to_file); |
666 | 666 |
667 if (resource_scheduling_filter_.get() && loading_task_runner) { | 667 if (resource_scheduling_filter_.get() && loading_task_runner) { |
668 resource_scheduling_filter_->SetRequestIdTaskRunner(request_id, | 668 resource_scheduling_filter_->SetRequestIdTaskRunner(request_id, |
669 loading_task_runner); | 669 loading_task_runner); |
670 } | 670 } |
| 671 request->request_start = pending_requests_[request_id]->request_start; |
671 | 672 |
672 if (ipc_type == blink::WebURLRequest::LoadingIPCType::Mojo) { | 673 if (ipc_type == blink::WebURLRequest::LoadingIPCType::Mojo) { |
673 std::unique_ptr<URLLoaderClientImpl> client( | 674 std::unique_ptr<URLLoaderClientImpl> client( |
674 new URLLoaderClientImpl(request_id, this, main_thread_task_runner_)); | 675 new URLLoaderClientImpl(request_id, this, main_thread_task_runner_)); |
675 mojom::URLLoaderAssociatedPtr url_loader; | 676 mojom::URLLoaderAssociatedPtr url_loader; |
676 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info; | 677 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info; |
677 client->Bind(&client_ptr_info, associated_group); | 678 client->Bind(&client_ptr_info, associated_group); |
678 url_loader_factory->CreateLoaderAndStart( | 679 url_loader_factory->CreateLoaderAndStart( |
679 MakeRequest(&url_loader, associated_group), routing_id, request_id, | 680 MakeRequest(&url_loader, associated_group), routing_id, request_id, |
680 *request, std::move(client_ptr_info)); | 681 *request, std::move(client_ptr_info)); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 delete message; | 823 delete message; |
823 } | 824 } |
824 } | 825 } |
825 | 826 |
826 void ResourceDispatcher::SetResourceSchedulingFilter( | 827 void ResourceDispatcher::SetResourceSchedulingFilter( |
827 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { | 828 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { |
828 resource_scheduling_filter_ = resource_scheduling_filter; | 829 resource_scheduling_filter_ = resource_scheduling_filter; |
829 } | 830 } |
830 | 831 |
831 } // namespace content | 832 } // namespace content |
OLD | NEW |