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