| 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/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 for (std::set<GlobalRoutingID>::const_iterator iter = ids.begin(); | 812 for (std::set<GlobalRoutingID>::const_iterator iter = ids.begin(); |
| 813 iter != ids.end(); ++iter) { | 813 iter != ids.end(); ++iter) { |
| 814 CancelBlockedRequestsForRoute(iter->child_id, iter->route_id); | 814 CancelBlockedRequestsForRoute(iter->child_id, iter->route_id); |
| 815 } | 815 } |
| 816 | 816 |
| 817 scheduler_.reset(); | 817 scheduler_.reset(); |
| 818 } | 818 } |
| 819 | 819 |
| 820 bool ResourceDispatcherHostImpl::OnMessageReceived( | 820 bool ResourceDispatcherHostImpl::OnMessageReceived( |
| 821 const IPC::Message& message, | 821 const IPC::Message& message, |
| 822 ResourceMessageFilter* filter, | 822 ResourceMessageFilter* filter) { |
| 823 bool* message_was_ok) { | |
| 824 filter_ = filter; | 823 filter_ = filter; |
| 825 bool handled = true; | 824 bool handled = true; |
| 826 IPC_BEGIN_MESSAGE_MAP_EX(ResourceDispatcherHostImpl, message, *message_was_ok) | 825 IPC_BEGIN_MESSAGE_MAP(ResourceDispatcherHostImpl, message) |
| 827 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) | 826 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) |
| 828 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) | 827 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) |
| 829 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile, | 828 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile, |
| 830 OnReleaseDownloadedFile) | 829 OnReleaseDownloadedFile) |
| 831 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK) | 830 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK) |
| 832 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK) | 831 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK) |
| 833 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) | 832 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) |
| 834 IPC_MESSAGE_UNHANDLED(handled = false) | 833 IPC_MESSAGE_UNHANDLED(handled = false) |
| 835 IPC_END_MESSAGE_MAP_EX() | 834 IPC_END_MESSAGE_MAP() |
| 836 | 835 |
| 837 if (!handled && IPC_MESSAGE_ID_CLASS(message.type()) == ResourceMsgStart) { | 836 if (!handled && IPC_MESSAGE_ID_CLASS(message.type()) == ResourceMsgStart) { |
| 838 PickleIterator iter(message); | 837 PickleIterator iter(message); |
| 839 int request_id = -1; | 838 int request_id = -1; |
| 840 bool ok = iter.ReadInt(&request_id); | 839 bool ok = iter.ReadInt(&request_id); |
| 841 DCHECK(ok); | 840 DCHECK(ok); |
| 842 GlobalRequestID id(filter_->child_id(), request_id); | 841 GlobalRequestID id(filter_->child_id(), request_id); |
| 843 DelegateMap::iterator it = delegate_map_.find(id); | 842 DelegateMap::iterator it = delegate_map_.find(id); |
| 844 if (it != delegate_map_.end()) { | 843 if (it != delegate_map_.end()) { |
| 845 ObserverList<ResourceMessageDelegate>::Iterator del_it(*it->second); | 844 ObserverList<ResourceMessageDelegate>::Iterator del_it(*it->second); |
| 846 ResourceMessageDelegate* delegate; | 845 ResourceMessageDelegate* delegate; |
| 847 while (!handled && (delegate = del_it.GetNext()) != NULL) { | 846 while (!handled && (delegate = del_it.GetNext()) != NULL) { |
| 848 handled = delegate->OnMessageReceived(message, message_was_ok); | 847 handled = delegate->OnMessageReceived(message); |
| 849 } | 848 } |
| 850 } | 849 } |
| 851 | 850 |
| 852 // As the unhandled resource message effectively has no consumer, mark it as | 851 // As the unhandled resource message effectively has no consumer, mark it as |
| 853 // handled to prevent needless propagation through the filter pipeline. | 852 // handled to prevent needless propagation through the filter pipeline. |
| 854 handled = true; | 853 handled = true; |
| 855 } | 854 } |
| 856 | 855 |
| 857 filter_ = NULL; | 856 filter_ = NULL; |
| 858 return handled; | 857 return handled; |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1973 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 1972 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
| 1974 && !policy->CanReadRawCookies(child_id)) { | 1973 && !policy->CanReadRawCookies(child_id)) { |
| 1975 VLOG(1) << "Denied unauthorized request for raw headers"; | 1974 VLOG(1) << "Denied unauthorized request for raw headers"; |
| 1976 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 1975 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
| 1977 } | 1976 } |
| 1978 | 1977 |
| 1979 return load_flags; | 1978 return load_flags; |
| 1980 } | 1979 } |
| 1981 | 1980 |
| 1982 } // namespace content | 1981 } // namespace content |
| OLD | NEW |