| 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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 492 |
| 493 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 493 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| 494 if (!request_info) | 494 if (!request_info) |
| 495 return; | 495 return; |
| 496 | 496 |
| 497 request_info->peer->OnDownloadedData(data_len, encoded_data_length); | 497 request_info->peer->OnDownloadedData(data_len, encoded_data_length); |
| 498 } | 498 } |
| 499 | 499 |
| 500 void ResourceDispatcher::OnReceivedRedirect( | 500 void ResourceDispatcher::OnReceivedRedirect( |
| 501 int request_id, | 501 int request_id, |
| 502 const GURL& new_url, | 502 const net::RedirectInfo& redirect_info, |
| 503 const GURL& new_first_party_for_cookies, | |
| 504 const ResourceResponseHead& response_head) { | 503 const ResourceResponseHead& response_head) { |
| 505 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedRedirect"); | 504 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedRedirect"); |
| 506 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 505 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| 507 if (!request_info) | 506 if (!request_info) |
| 508 return; | 507 return; |
| 509 request_info->response_start = ConsumeIOTimestamp(); | 508 request_info->response_start = ConsumeIOTimestamp(); |
| 510 | 509 |
| 511 ResourceResponseInfo renderer_response_info; | 510 ResourceResponseInfo renderer_response_info; |
| 512 ToResourceResponseInfo(*request_info, response_head, &renderer_response_info); | 511 ToResourceResponseInfo(*request_info, response_head, &renderer_response_info); |
| 513 if (request_info->peer->OnReceivedRedirect( | 512 if (request_info->peer->OnReceivedRedirect(redirect_info, |
| 514 new_url, new_first_party_for_cookies, renderer_response_info)) { | 513 renderer_response_info)) { |
| 515 // Double-check if the request is still around. The call above could | 514 // Double-check if the request is still around. The call above could |
| 516 // potentially remove it. | 515 // potentially remove it. |
| 517 request_info = GetPendingRequestInfo(request_id); | 516 request_info = GetPendingRequestInfo(request_id); |
| 518 if (!request_info) | 517 if (!request_info) |
| 519 return; | 518 return; |
| 520 // We update the response_url here so that we can send it to | 519 // We update the response_url here so that we can send it to |
| 521 // SiteIsolationPolicy later when OnReceivedResponse is called. | 520 // SiteIsolationPolicy later when OnReceivedResponse is called. |
| 522 request_info->response_url = new_url; | 521 request_info->response_url = redirect_info.new_url; |
| 523 request_info->pending_redirect_message.reset( | 522 request_info->pending_redirect_message.reset( |
| 524 new ResourceHostMsg_FollowRedirect(request_id)); | 523 new ResourceHostMsg_FollowRedirect(request_id)); |
| 525 if (!request_info->is_deferred) { | 524 if (!request_info->is_deferred) { |
| 526 FollowPendingRedirect(request_id, *request_info); | 525 FollowPendingRedirect(request_id, *request_info); |
| 527 } | 526 } |
| 528 } else { | 527 } else { |
| 529 CancelPendingRequest(request_id); | 528 CancelPendingRequest(request_id); |
| 530 } | 529 } |
| 531 } | 530 } |
| 532 | 531 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { | 859 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { |
| 861 while (!queue->empty()) { | 860 while (!queue->empty()) { |
| 862 IPC::Message* message = queue->front(); | 861 IPC::Message* message = queue->front(); |
| 863 ReleaseResourcesInDataMessage(*message); | 862 ReleaseResourcesInDataMessage(*message); |
| 864 queue->pop_front(); | 863 queue->pop_front(); |
| 865 delete message; | 864 delete message; |
| 866 } | 865 } |
| 867 } | 866 } |
| 868 | 867 |
| 869 } // namespace content | 868 } // namespace content |
| OLD | NEW |