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

Issue 3832006: Made ObserverListThreadSafe's destructor private since it's ref-counted. (Closed)

Created:
10 years, 2 months ago by akalin
Modified:
9 years, 7 months ago
CC:
chromium-reviews, brettw-cc_chromium.org
Visibility:
Public.

Description

Made ObserverListThreadSafe's destructor private since it's ref-counted. BUG=None TEST=Compiles Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=70933

Patch Set 1 #

Patch Set 2 : Synced to head #

Unified diffs Side-by-side diffs Delta from patch set Stats (+9 lines, -7 lines) Patch
M base/observer_list_threadsafe.h View 2 chunks +9 lines, -7 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
akalin
+willchan
10 years, 2 months ago (2010-10-15 21:40:35 UTC) #1
willchan no longer on Chromium
10 years, 2 months ago (2010-10-15 21:45:24 UTC) #2
LGTM

On Fri, Oct 15, 2010 at 2:40 PM, <akalin@chromium.org> wrote:

> Reviewers: willchan,
>
> Message:
> +willchan
>
> Description:
> Made ObserverListThreadSafe's destructor private since it's ref-counted.
>
> BUG=None
> TEST=Compiles
>
> Please review this at http://codereview.chromium.org/3832006/show
>
> SVN Base: http://git.chromium.org/git/chromium.git
>
> Affected files:
>  M base/observer_list_threadsafe.h
>
>
> 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_);
>
>
>

Powered by Google App Engine
This is Rietveld 408576698