Chromium Code Reviews| 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 <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1024 IPC_END_MESSAGE_MAP() | 1024 IPC_END_MESSAGE_MAP() |
| 1025 | 1025 |
| 1026 if (!handled && IPC_MESSAGE_ID_CLASS(message.type()) == ResourceMsgStart) { | 1026 if (!handled && IPC_MESSAGE_ID_CLASS(message.type()) == ResourceMsgStart) { |
| 1027 base::PickleIterator iter(message); | 1027 base::PickleIterator iter(message); |
| 1028 int request_id = -1; | 1028 int request_id = -1; |
| 1029 bool ok = iter.ReadInt(&request_id); | 1029 bool ok = iter.ReadInt(&request_id); |
| 1030 DCHECK(ok); | 1030 DCHECK(ok); |
| 1031 GlobalRequestID id(filter_->child_id(), request_id); | 1031 GlobalRequestID id(filter_->child_id(), request_id); |
| 1032 DelegateMap::iterator it = delegate_map_.find(id); | 1032 DelegateMap::iterator it = delegate_map_.find(id); |
| 1033 if (it != delegate_map_.end()) { | 1033 if (it != delegate_map_.end()) { |
| 1034 base::ObserverList<ResourceMessageDelegate>::Iterator del_it(it->second); | 1034 for (auto& delegate : *it->second) { |
| 1035 ResourceMessageDelegate* delegate; | 1035 if (delegate.OnMessageReceived(message)) { |
| 1036 while (!handled && (delegate = del_it.GetNext()) != NULL) { | 1036 handled = true; |
|
dcheng
2016/10/12 22:59:05
This is technically redundant given line 1047, but
| |
| 1037 handled = delegate->OnMessageReceived(message); | 1037 break; |
| 1038 } | |
| 1038 } | 1039 } |
| 1039 } | 1040 } |
| 1040 | 1041 |
| 1041 // As the unhandled resource message effectively has no consumer, mark it as | 1042 // As the unhandled resource message effectively has no consumer, mark it as |
| 1042 // handled to prevent needless propagation through the filter pipeline. | 1043 // handled to prevent needless propagation through the filter pipeline. |
| 1043 handled = true; | 1044 handled = true; |
| 1044 } | 1045 } |
| 1045 | 1046 |
| 1046 filter_ = NULL; | 1047 filter_ = NULL; |
| 1047 return handled; | 1048 return handled; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1163 blocked_loaders_map_.end()) { | 1164 blocked_loaders_map_.end()) { |
| 1164 blocked_loaders_map_[new_routing_id] = | 1165 blocked_loaders_map_[new_routing_id] = |
| 1165 std::move(blocked_loaders_map_[old_routing_id]); | 1166 std::move(blocked_loaders_map_[old_routing_id]); |
| 1166 blocked_loaders_map_.erase(old_routing_id); | 1167 blocked_loaders_map_.erase(old_routing_id); |
| 1167 } | 1168 } |
| 1168 } | 1169 } |
| 1169 if (old_request_id != new_request_id) { | 1170 if (old_request_id != new_request_id) { |
| 1170 DelegateMap::iterator it = delegate_map_.find(old_request_id); | 1171 DelegateMap::iterator it = delegate_map_.find(old_request_id); |
| 1171 if (it != delegate_map_.end()) { | 1172 if (it != delegate_map_.end()) { |
| 1172 // Tell each delegate that the request ID has changed. | 1173 // Tell each delegate that the request ID has changed. |
| 1173 base::ObserverList<ResourceMessageDelegate>::Iterator del_it(it->second); | 1174 for (auto& delegate : *it->second) |
| 1174 ResourceMessageDelegate* delegate; | 1175 delegate.set_request_id(new_request_id); |
| 1175 while ((delegate = del_it.GetNext()) != NULL) { | |
| 1176 delegate->set_request_id(new_request_id); | |
| 1177 } | |
| 1178 // Now store the observer list under the new request ID. | 1176 // Now store the observer list under the new request ID. |
| 1179 delegate_map_[new_request_id] = delegate_map_[old_request_id]; | 1177 delegate_map_[new_request_id] = delegate_map_[old_request_id]; |
| 1180 delegate_map_.erase(old_request_id); | 1178 delegate_map_.erase(old_request_id); |
| 1181 } | 1179 } |
| 1182 } | 1180 } |
| 1183 | 1181 |
| 1184 AppCacheInterceptor::CompleteCrossSiteTransfer( | 1182 AppCacheInterceptor::CompleteCrossSiteTransfer( |
| 1185 loader_ptr->request(), | 1183 loader_ptr->request(), |
| 1186 child_id, | 1184 child_id, |
| 1187 request_data.appcache_host_id, | 1185 request_data.appcache_host_id, |
| (...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2735 &throttles); | 2733 &throttles); |
| 2736 if (!throttles.empty()) { | 2734 if (!throttles.empty()) { |
| 2737 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2735 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
| 2738 std::move(throttles))); | 2736 std::move(throttles))); |
| 2739 } | 2737 } |
| 2740 } | 2738 } |
| 2741 return handler; | 2739 return handler; |
| 2742 } | 2740 } |
| 2743 | 2741 |
| 2744 } // namespace content | 2742 } // namespace content |
| OLD | NEW |