| 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 "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 | 484 |
| 485 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 485 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| 486 if (!request_info) | 486 if (!request_info) |
| 487 return; | 487 return; |
| 488 | 488 |
| 489 request_info->peer->OnDownloadedData(data_len, encoded_data_length); | 489 request_info->peer->OnDownloadedData(data_len, encoded_data_length); |
| 490 } | 490 } |
| 491 | 491 |
| 492 void ResourceDispatcher::OnReceivedRedirect( | 492 void ResourceDispatcher::OnReceivedRedirect( |
| 493 int request_id, | 493 int request_id, |
| 494 const GURL& new_url, | 494 const net::RedirectInfo& redirect_info, |
| 495 const GURL& new_first_party_for_cookies, | |
| 496 const ResourceResponseHead& response_head) { | 495 const ResourceResponseHead& response_head) { |
| 497 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedRedirect"); | 496 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedRedirect"); |
| 498 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 497 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| 499 if (!request_info) | 498 if (!request_info) |
| 500 return; | 499 return; |
| 501 request_info->response_start = ConsumeIOTimestamp(); | 500 request_info->response_start = ConsumeIOTimestamp(); |
| 502 | 501 |
| 503 ResourceResponseInfo renderer_response_info; | 502 ResourceResponseInfo renderer_response_info; |
| 504 ToResourceResponseInfo(*request_info, response_head, &renderer_response_info); | 503 ToResourceResponseInfo(*request_info, response_head, &renderer_response_info); |
| 505 if (request_info->peer->OnReceivedRedirect( | 504 if (request_info->peer->OnReceivedRedirect(redirect_info, |
| 506 new_url, new_first_party_for_cookies, renderer_response_info)) { | 505 renderer_response_info)) { |
| 507 // Double-check if the request is still around. The call above could | 506 // Double-check if the request is still around. The call above could |
| 508 // potentially remove it. | 507 // potentially remove it. |
| 509 request_info = GetPendingRequestInfo(request_id); | 508 request_info = GetPendingRequestInfo(request_id); |
| 510 if (!request_info) | 509 if (!request_info) |
| 511 return; | 510 return; |
| 512 // We update the response_url here so that we can send it to | 511 // We update the response_url here so that we can send it to |
| 513 // SiteIsolationPolicy later when OnReceivedResponse is called. | 512 // SiteIsolationPolicy later when OnReceivedResponse is called. |
| 514 request_info->response_url = new_url; | 513 request_info->response_url = redirect_info.new_url; |
| 515 request_info->pending_redirect_message.reset( | 514 request_info->pending_redirect_message.reset( |
| 516 new ResourceHostMsg_FollowRedirect(request_id)); | 515 new ResourceHostMsg_FollowRedirect(request_id)); |
| 517 if (!request_info->is_deferred) { | 516 if (!request_info->is_deferred) { |
| 518 FollowPendingRedirect(request_id, *request_info); | 517 FollowPendingRedirect(request_id, *request_info); |
| 519 } | 518 } |
| 520 } else { | 519 } else { |
| 521 CancelPendingRequest(request_id); | 520 CancelPendingRequest(request_id); |
| 522 } | 521 } |
| 523 } | 522 } |
| 524 | 523 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { | 851 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { |
| 853 while (!queue->empty()) { | 852 while (!queue->empty()) { |
| 854 IPC::Message* message = queue->front(); | 853 IPC::Message* message = queue->front(); |
| 855 ReleaseResourcesInDataMessage(*message); | 854 ReleaseResourcesInDataMessage(*message); |
| 856 queue->pop_front(); | 855 queue->pop_front(); |
| 857 delete message; | 856 delete message; |
| 858 } | 857 } |
| 859 } | 858 } |
| 860 | 859 |
| 861 } // namespace content | 860 } // namespace content |
| OLD | NEW |