| 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 return true; | 578 return true; |
| 579 } | 579 } |
| 580 | 580 |
| 581 void ResourceDispatcher::CancelPendingRequest(int request_id) { | 581 void ResourceDispatcher::CancelPendingRequest(int request_id) { |
| 582 PendingRequestList::iterator it = pending_requests_.find(request_id); | 582 PendingRequestList::iterator it = pending_requests_.find(request_id); |
| 583 if (it == pending_requests_.end()) { | 583 if (it == pending_requests_.end()) { |
| 584 DVLOG(1) << "unknown request"; | 584 DVLOG(1) << "unknown request"; |
| 585 return; | 585 return; |
| 586 } | 586 } |
| 587 | 587 |
| 588 SiteIsolationPolicy::OnRequestComplete(request_id); | 588 // |request_id| will be removed from |pending_requests_| when |
| 589 PendingRequestInfo& request_info = it->second; | 589 // OnRequestComplete returns with ERR_ABORTED. |
| 590 ReleaseResourcesInMessageQueue(&request_info.deferred_message_queue); | |
| 591 pending_requests_.erase(it); | |
| 592 | |
| 593 message_sender()->Send(new ResourceHostMsg_CancelRequest(request_id)); | 590 message_sender()->Send(new ResourceHostMsg_CancelRequest(request_id)); |
| 594 } | 591 } |
| 595 | 592 |
| 596 void ResourceDispatcher::SetDefersLoading(int request_id, bool value) { | 593 void ResourceDispatcher::SetDefersLoading(int request_id, bool value) { |
| 597 PendingRequestList::iterator it = pending_requests_.find(request_id); | 594 PendingRequestList::iterator it = pending_requests_.find(request_id); |
| 598 if (it == pending_requests_.end()) { | 595 if (it == pending_requests_.end()) { |
| 599 DLOG(ERROR) << "unknown request"; | 596 DLOG(ERROR) << "unknown request"; |
| 600 return; | 597 return; |
| 601 } | 598 } |
| 602 PendingRequestInfo& request_info = it->second; | 599 PendingRequestInfo& request_info = it->second; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { | 800 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { |
| 804 while (!queue->empty()) { | 801 while (!queue->empty()) { |
| 805 IPC::Message* message = queue->front(); | 802 IPC::Message* message = queue->front(); |
| 806 ReleaseResourcesInDataMessage(*message); | 803 ReleaseResourcesInDataMessage(*message); |
| 807 queue->pop_front(); | 804 queue->pop_front(); |
| 808 delete message; | 805 delete message; |
| 809 } | 806 } |
| 810 } | 807 } |
| 811 | 808 |
| 812 } // namespace content | 809 } // namespace content |
| OLD | NEW |