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

Unified Diff: chrome/browser/extensions/event_listener_map.cc

Issue 12301019: Correct the OnListenerRemoved semantic of EventListenerMap::Delegate (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/event_listener_map.cc
diff --git a/chrome/browser/extensions/event_listener_map.cc b/chrome/browser/extensions/event_listener_map.cc
index 57fd198483cfdf9bae5e067ed07732d59a065fe4..f6744477748eeeed3d3926dfa8030835f9c5982d 100644
--- a/chrome/browser/extensions/event_listener_map.cc
+++ b/chrome/browser/extensions/event_listener_map.cc
@@ -80,11 +80,11 @@ bool EventListenerMap::RemoveListener(const EventListener* listener) {
for (ListenerList::iterator it = listeners.begin(); it != listeners.end();
it++) {
if ((*it)->Equals(listener)) {
- delegate_->OnListenerRemoved(it->get());
CleanupListener(it->get());
// Popping from the back should be cheaper than erase(it).
std::swap(*it, listeners.back());
listeners.pop_back();
+ delegate_->OnListenerRemoved(listener);
return true;
}
}
@@ -215,9 +215,10 @@ void EventListenerMap::RemoveListenersForProcess(
for (ListenerList::iterator it2 = it->second.begin();
it2 != it->second.end();) {
if ((*it2)->process == process) {
- delegate_->OnListenerRemoved(it2->get());
+ linked_ptr<EventListener> listener(*it2);
CleanupListener(it2->get());
it2 = it->second.erase(it2);
+ delegate_->OnListenerRemoved(listener.get());
} else {
it2++;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698