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

Unified Diff: base/observer_list_threadsafe.h

Issue 3832006: Made ObserverListThreadSafe's destructor private since it's ref-counted. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Synced to head Created 9 years, 11 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: base/observer_list_threadsafe.h
diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h
index d034e6cd50255b81e891a123a4fa9fe0ee1b33a8..6085fde74ba9093ec59edf38e53c4f57eb65f7db 100644
--- a/base/observer_list_threadsafe.h
+++ b/base/observer_list_threadsafe.h
@@ -60,13 +60,6 @@ class ObserverListThreadSafe
: type_(ObserverListBase<ObserverType>::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<ObserverType>* list = NULL;
@@ -137,6 +130,15 @@ class ObserverListThreadSafe
// TODO(mbelshe): Add more wrappers for Notify() with more arguments.
private:
+ friend class
+ base::RefCountedThreadSafe<ObserverListThreadSafe<ObserverType> >;
+ ~ObserverListThreadSafe() {
+ typename ObserversListMap::const_iterator it;
+ for (it = observer_lists_.begin(); it != observer_lists_.end(); ++it)
+ delete (*it).second;
+ observer_lists_.clear();
+ }
+
template <class Method, class Params>
void Notify(const UnboundMethod<ObserverType, Method, Params>& method) {
AutoLock lock(list_lock_);
« 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