Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1162943002: Replace more ObserverList with base::ObserverList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@observer
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 IPC_END_MESSAGE_MAP() 982 IPC_END_MESSAGE_MAP()
983 983
984 if (!handled && IPC_MESSAGE_ID_CLASS(message.type()) == ResourceMsgStart) { 984 if (!handled && IPC_MESSAGE_ID_CLASS(message.type()) == ResourceMsgStart) {
985 PickleIterator iter(message); 985 PickleIterator iter(message);
986 int request_id = -1; 986 int request_id = -1;
987 bool ok = iter.ReadInt(&request_id); 987 bool ok = iter.ReadInt(&request_id);
988 DCHECK(ok); 988 DCHECK(ok);
989 GlobalRequestID id(filter_->child_id(), request_id); 989 GlobalRequestID id(filter_->child_id(), request_id);
990 DelegateMap::iterator it = delegate_map_.find(id); 990 DelegateMap::iterator it = delegate_map_.find(id);
991 if (it != delegate_map_.end()) { 991 if (it != delegate_map_.end()) {
992 ObserverList<ResourceMessageDelegate>::Iterator del_it(it->second); 992 base::ObserverList<ResourceMessageDelegate>::Iterator del_it(it->second);
993 ResourceMessageDelegate* delegate; 993 ResourceMessageDelegate* delegate;
994 while (!handled && (delegate = del_it.GetNext()) != NULL) { 994 while (!handled && (delegate = del_it.GetNext()) != NULL) {
995 handled = delegate->OnMessageReceived(message); 995 handled = delegate->OnMessageReceived(message);
996 } 996 }
997 } 997 }
998 998
999 // As the unhandled resource message effectively has no consumer, mark it as 999 // As the unhandled resource message effectively has no consumer, mark it as
1000 // handled to prevent needless propagation through the filter pipeline. 1000 // handled to prevent needless propagation through the filter pipeline.
1001 handled = true; 1001 handled = true;
1002 } 1002 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 blocked_loaders_map_.end()) { 1089 blocked_loaders_map_.end()) {
1090 blocked_loaders_map_[new_routing_id] = 1090 blocked_loaders_map_[new_routing_id] =
1091 blocked_loaders_map_[old_routing_id]; 1091 blocked_loaders_map_[old_routing_id];
1092 blocked_loaders_map_.erase(old_routing_id); 1092 blocked_loaders_map_.erase(old_routing_id);
1093 } 1093 }
1094 } 1094 }
1095 if (old_request_id != new_request_id) { 1095 if (old_request_id != new_request_id) {
1096 DelegateMap::iterator it = delegate_map_.find(old_request_id); 1096 DelegateMap::iterator it = delegate_map_.find(old_request_id);
1097 if (it != delegate_map_.end()) { 1097 if (it != delegate_map_.end()) {
1098 // Tell each delegate that the request ID has changed. 1098 // Tell each delegate that the request ID has changed.
1099 ObserverList<ResourceMessageDelegate>::Iterator del_it(it->second); 1099 base::ObserverList<ResourceMessageDelegate>::Iterator del_it(it->second);
1100 ResourceMessageDelegate* delegate; 1100 ResourceMessageDelegate* delegate;
1101 while ((delegate = del_it.GetNext()) != NULL) { 1101 while ((delegate = del_it.GetNext()) != NULL) {
1102 delegate->set_request_id(new_request_id); 1102 delegate->set_request_id(new_request_id);
1103 } 1103 }
1104 // Now store the observer list under the new request ID. 1104 // Now store the observer list under the new request ID.
1105 delegate_map_[new_request_id] = delegate_map_[old_request_id]; 1105 delegate_map_[new_request_id] = delegate_map_[old_request_id];
1106 delegate_map_.erase(old_request_id); 1106 delegate_map_.erase(old_request_id);
1107 } 1107 }
1108 } 1108 }
1109 1109
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
2303 ResourceLoader* ResourceDispatcherHostImpl::GetLoader(int child_id, 2303 ResourceLoader* ResourceDispatcherHostImpl::GetLoader(int child_id,
2304 int request_id) const { 2304 int request_id) const {
2305 return GetLoader(GlobalRequestID(child_id, request_id)); 2305 return GetLoader(GlobalRequestID(child_id, request_id));
2306 } 2306 }
2307 2307
2308 void ResourceDispatcherHostImpl::RegisterResourceMessageDelegate( 2308 void ResourceDispatcherHostImpl::RegisterResourceMessageDelegate(
2309 const GlobalRequestID& id, ResourceMessageDelegate* delegate) { 2309 const GlobalRequestID& id, ResourceMessageDelegate* delegate) {
2310 DelegateMap::iterator it = delegate_map_.find(id); 2310 DelegateMap::iterator it = delegate_map_.find(id);
2311 if (it == delegate_map_.end()) { 2311 if (it == delegate_map_.end()) {
2312 it = delegate_map_.insert( 2312 it = delegate_map_.insert(
2313 std::make_pair(id, new ObserverList<ResourceMessageDelegate>)).first; 2313 std::make_pair(
2314 id,
2315 new base::ObserverList<ResourceMessageDelegate>))
2316 .first;
2314 } 2317 }
2315 it->second->AddObserver(delegate); 2318 it->second->AddObserver(delegate);
2316 } 2319 }
2317 2320
2318 void ResourceDispatcherHostImpl::UnregisterResourceMessageDelegate( 2321 void ResourceDispatcherHostImpl::UnregisterResourceMessageDelegate(
2319 const GlobalRequestID& id, ResourceMessageDelegate* delegate) { 2322 const GlobalRequestID& id, ResourceMessageDelegate* delegate) {
2320 DCHECK(ContainsKey(delegate_map_, id)); 2323 DCHECK(ContainsKey(delegate_map_, id));
2321 DelegateMap::iterator it = delegate_map_.find(id); 2324 DelegateMap::iterator it = delegate_map_.find(id);
2322 DCHECK(it->second->HasObserver(delegate)); 2325 DCHECK(it->second->HasObserver(delegate));
2323 it->second->RemoveObserver(delegate); 2326 it->second->RemoveObserver(delegate);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 2368
2366 // Add a flag to selectively bypass the data reduction proxy if the resource 2369 // Add a flag to selectively bypass the data reduction proxy if the resource
2367 // type is not an image. 2370 // type is not an image.
2368 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) 2371 if (request_data.resource_type != RESOURCE_TYPE_IMAGE)
2369 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; 2372 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY;
2370 2373
2371 return load_flags; 2374 return load_flags;
2372 } 2375 }
2373 2376
2374 } // namespace content 2377 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.h ('k') | content/browser/media/webrtc_internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698