| 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 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 IPC_END_MESSAGE_MAP() | 950 IPC_END_MESSAGE_MAP() |
| 951 | 951 |
| 952 if (!handled && IPC_MESSAGE_ID_CLASS(message.type()) == ResourceMsgStart) { | 952 if (!handled && IPC_MESSAGE_ID_CLASS(message.type()) == ResourceMsgStart) { |
| 953 PickleIterator iter(message); | 953 PickleIterator iter(message); |
| 954 int request_id = -1; | 954 int request_id = -1; |
| 955 bool ok = iter.ReadInt(&request_id); | 955 bool ok = iter.ReadInt(&request_id); |
| 956 DCHECK(ok); | 956 DCHECK(ok); |
| 957 GlobalRequestID id(filter_->child_id(), request_id); | 957 GlobalRequestID id(filter_->child_id(), request_id); |
| 958 DelegateMap::iterator it = delegate_map_.find(id); | 958 DelegateMap::iterator it = delegate_map_.find(id); |
| 959 if (it != delegate_map_.end()) { | 959 if (it != delegate_map_.end()) { |
| 960 ObserverList<ResourceMessageDelegate>::Iterator del_it(*it->second); | 960 ObserverList<ResourceMessageDelegate>::Iterator del_it(it->second); |
| 961 ResourceMessageDelegate* delegate; | 961 ResourceMessageDelegate* delegate; |
| 962 while (!handled && (delegate = del_it.GetNext()) != NULL) { | 962 while (!handled && (delegate = del_it.GetNext()) != NULL) { |
| 963 handled = delegate->OnMessageReceived(message); | 963 handled = delegate->OnMessageReceived(message); |
| 964 } | 964 } |
| 965 } | 965 } |
| 966 | 966 |
| 967 // As the unhandled resource message effectively has no consumer, mark it as | 967 // As the unhandled resource message effectively has no consumer, mark it as |
| 968 // handled to prevent needless propagation through the filter pipeline. | 968 // handled to prevent needless propagation through the filter pipeline. |
| 969 handled = true; | 969 handled = true; |
| 970 } | 970 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 blocked_loaders_map_.end()) { | 1053 blocked_loaders_map_.end()) { |
| 1054 blocked_loaders_map_[new_routing_id] = | 1054 blocked_loaders_map_[new_routing_id] = |
| 1055 blocked_loaders_map_[old_routing_id]; | 1055 blocked_loaders_map_[old_routing_id]; |
| 1056 blocked_loaders_map_.erase(old_routing_id); | 1056 blocked_loaders_map_.erase(old_routing_id); |
| 1057 } | 1057 } |
| 1058 } | 1058 } |
| 1059 if (old_request_id != new_request_id) { | 1059 if (old_request_id != new_request_id) { |
| 1060 DelegateMap::iterator it = delegate_map_.find(old_request_id); | 1060 DelegateMap::iterator it = delegate_map_.find(old_request_id); |
| 1061 if (it != delegate_map_.end()) { | 1061 if (it != delegate_map_.end()) { |
| 1062 // Tell each delegate that the request ID has changed. | 1062 // Tell each delegate that the request ID has changed. |
| 1063 ObserverList<ResourceMessageDelegate>::Iterator del_it(*it->second); | 1063 ObserverList<ResourceMessageDelegate>::Iterator del_it(it->second); |
| 1064 ResourceMessageDelegate* delegate; | 1064 ResourceMessageDelegate* delegate; |
| 1065 while ((delegate = del_it.GetNext()) != NULL) { | 1065 while ((delegate = del_it.GetNext()) != NULL) { |
| 1066 delegate->set_request_id(new_request_id); | 1066 delegate->set_request_id(new_request_id); |
| 1067 } | 1067 } |
| 1068 // Now store the observer list under the new request ID. | 1068 // Now store the observer list under the new request ID. |
| 1069 delegate_map_[new_request_id] = delegate_map_[old_request_id]; | 1069 delegate_map_[new_request_id] = delegate_map_[old_request_id]; |
| 1070 delegate_map_.erase(old_request_id); | 1070 delegate_map_.erase(old_request_id); |
| 1071 } | 1071 } |
| 1072 } | 1072 } |
| 1073 | 1073 |
| (...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2352 | 2352 |
| 2353 // Add a flag to selectively bypass the data reduction proxy if the resource | 2353 // Add a flag to selectively bypass the data reduction proxy if the resource |
| 2354 // type is not an image. | 2354 // type is not an image. |
| 2355 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2355 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
| 2356 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2356 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
| 2357 | 2357 |
| 2358 return load_flags; | 2358 return load_flags; |
| 2359 } | 2359 } |
| 2360 | 2360 |
| 2361 } // namespace content | 2361 } // namespace content |
| OLD | NEW |