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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2410283004: Remove usage of base::ObserverList<T>::Iter::GetNext() in //content. (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/service_worker/embedded_worker_instance.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index 14bfe1749fb58250ddd77a038091b436aa48b309..29092f2f42fb58e037377acbf6181fdca5692685 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -1031,10 +1031,11 @@ bool ResourceDispatcherHostImpl::OnMessageReceived(
GlobalRequestID id(filter_->child_id(), request_id);
DelegateMap::iterator it = delegate_map_.find(id);
if (it != delegate_map_.end()) {
- base::ObserverList<ResourceMessageDelegate>::Iterator del_it(it->second);
- ResourceMessageDelegate* delegate;
- while (!handled && (delegate = del_it.GetNext()) != NULL) {
- handled = delegate->OnMessageReceived(message);
+ for (auto& delegate : *it->second) {
+ if (delegate.OnMessageReceived(message)) {
+ handled = true;
dcheng 2016/10/12 22:59:05 This is technically redundant given line 1047, but
+ break;
+ }
}
}
@@ -1170,11 +1171,8 @@ void ResourceDispatcherHostImpl::UpdateRequestForTransfer(
DelegateMap::iterator it = delegate_map_.find(old_request_id);
if (it != delegate_map_.end()) {
// Tell each delegate that the request ID has changed.
- base::ObserverList<ResourceMessageDelegate>::Iterator del_it(it->second);
- ResourceMessageDelegate* delegate;
- while ((delegate = del_it.GetNext()) != NULL) {
- delegate->set_request_id(new_request_id);
- }
+ for (auto& delegate : *it->second)
+ delegate.set_request_id(new_request_id);
// Now store the observer list under the new request ID.
delegate_map_[new_request_id] = delegate_map_[old_request_id];
delegate_map_.erase(old_request_id);
« no previous file with comments | « no previous file | content/browser/service_worker/embedded_worker_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698