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

Side by Side Diff: base/synchronization/waitable_event_watcher_posix.cc

Issue 9997007: Objects that derive from RefCounted/RefCountedThreadSafe should not have public dtors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: virtual & DISALLOW Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/synchronization/waitable_event.h ('k') | base/threading/worker_pool_posix.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/synchronization/waitable_event_watcher.h" 5 #include "base/synchronization/waitable_event_watcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 25 matching lines...) Expand all
36 AutoLock locked(lock_); 36 AutoLock locked(lock_);
37 flag_ = true; 37 flag_ = true;
38 } 38 }
39 39
40 bool value() const { 40 bool value() const {
41 AutoLock locked(lock_); 41 AutoLock locked(lock_);
42 return flag_; 42 return flag_;
43 } 43 }
44 44
45 private: 45 private:
46 friend class RefCountedThreadSafe<Flag>;
47 ~Flag() {}
48
46 mutable Lock lock_; 49 mutable Lock lock_;
47 bool flag_; 50 bool flag_;
51
52 DISALLOW_COPY_AND_ASSIGN(Flag);
48 }; 53 };
49 54
50 // ----------------------------------------------------------------------------- 55 // -----------------------------------------------------------------------------
51 // This is an asynchronous waiter which posts a task to a MessageLoop when 56 // This is an asynchronous waiter which posts a task to a MessageLoop when
52 // fired. An AsyncWaiter may only be in a single wait-list. 57 // fired. An AsyncWaiter may only be in a single wait-list.
53 // ----------------------------------------------------------------------------- 58 // -----------------------------------------------------------------------------
54 class AsyncWaiter : public WaitableEvent::Waiter { 59 class AsyncWaiter : public WaitableEvent::Waiter {
55 public: 60 public:
56 AsyncWaiter(MessageLoop* message_loop, 61 AsyncWaiter(MessageLoop* message_loop,
57 const base::Closure& callback, 62 const base::Closure& callback,
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // ----------------------------------------------------------------------------- 261 // -----------------------------------------------------------------------------
257 // This is called when the MessageLoop which the callback will be run it is 262 // This is called when the MessageLoop which the callback will be run it is
258 // deleted. We need to cancel the callback as if we had been deleted, but we 263 // deleted. We need to cancel the callback as if we had been deleted, but we
259 // will still be deleted at some point in the future. 264 // will still be deleted at some point in the future.
260 // ----------------------------------------------------------------------------- 265 // -----------------------------------------------------------------------------
261 void WaitableEventWatcher::WillDestroyCurrentMessageLoop() { 266 void WaitableEventWatcher::WillDestroyCurrentMessageLoop() {
262 StopWatching(); 267 StopWatching();
263 } 268 }
264 269
265 } // namespace base 270 } // namespace base
OLDNEW
« no previous file with comments | « base/synchronization/waitable_event.h ('k') | base/threading/worker_pool_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698