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