From 9230ac4333edf1449bfba5a3eea17e6b8064f3b0 Mon Sep 17 00:00:00 2001 From: "akalin@chromium.org" Date: Mon, 10 Jan 2011 20:40:36 +0000 Subject: Made ObserverListThreadSafe's destructor private since it's ref-counted. BUG=None TEST=Compiles Review URL: http://codereview.chromium.org/3832006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70933 0039d316-1c4b-4281-b951-d872f2087c98 --- base/observer_list_threadsafe.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'base') diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h index d034e6c..6085fde 100644 --- a/base/observer_list_threadsafe.h +++ b/base/observer_list_threadsafe.h @@ -60,13 +60,6 @@ class ObserverListThreadSafe : type_(ObserverListBase::NOTIFY_ALL) {} explicit ObserverListThreadSafe(NotificationType type) : type_(type) {} - ~ObserverListThreadSafe() { - typename ObserversListMap::const_iterator it; - for (it = observer_lists_.begin(); it != observer_lists_.end(); ++it) - delete (*it).second; - observer_lists_.clear(); - } - // Add an observer to the list. void AddObserver(ObserverType* obs) { ObserverList* list = NULL; @@ -137,6 +130,15 @@ class ObserverListThreadSafe // TODO(mbelshe): Add more wrappers for Notify() with more arguments. private: + friend class + base::RefCountedThreadSafe >; + ~ObserverListThreadSafe() { + typename ObserversListMap::const_iterator it; + for (it = observer_lists_.begin(); it != observer_lists_.end(); ++it) + delete (*it).second; + observer_lists_.clear(); + } + template void Notify(const UnboundMethod& method) { AutoLock lock(list_lock_); -- cgit v1.1