diff options
-rw-r--r-- | base/message_loop_proxy_impl.h | 14 | ||||
-rw-r--r-- | base/message_pump.h | 7 | ||||
-rw-r--r-- | base/message_pump_default.h | 6 | ||||
-rw-r--r-- | base/message_pump_libevent.h | 6 | ||||
-rw-r--r-- | base/message_pump_mac.h | 15 | ||||
-rw-r--r-- | base/message_pump_mac.mm | 6 | ||||
-rw-r--r-- | base/sequenced_task_runner.h | 5 | ||||
-rw-r--r-- | base/single_thread_task_runner.h | 5 | ||||
-rw-r--r-- | base/synchronization/waitable_event.h | 7 | ||||
-rw-r--r-- | base/synchronization/waitable_event_watcher_posix.cc | 7 | ||||
-rw-r--r-- | base/threading/worker_pool_posix.h | 4 | ||||
-rw-r--r-- | remoting/base/plugin_message_loop_proxy.h | 4 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_task_runner.h | 11 |
13 files changed, 72 insertions, 25 deletions
diff --git a/base/message_loop_proxy_impl.h b/base/message_loop_proxy_impl.h index 88e1d45..140c244 100644 --- a/base/message_loop_proxy_impl.h +++ b/base/message_loop_proxy_impl.h @@ -16,11 +16,8 @@ namespace base { // A stock implementation of MessageLoopProxy that is created and managed by a // MessageLoop. For now a MessageLoopProxyImpl can only be created as part of a // MessageLoop. -class BASE_EXPORT MessageLoopProxyImpl - : public MessageLoopProxy { +class BASE_EXPORT MessageLoopProxyImpl : public MessageLoopProxy { public: - virtual ~MessageLoopProxyImpl(); - // MessageLoopProxy implementation virtual bool PostDelayedTask(const tracked_objects::Location& from_here, const base::Closure& task, @@ -39,11 +36,17 @@ class BASE_EXPORT MessageLoopProxyImpl virtual bool RunsTasksOnCurrentThread() const OVERRIDE; protected: + virtual ~MessageLoopProxyImpl(); + // Override OnDestruct so that we can delete the object on the target message // loop if it still exists. virtual void OnDestruct() const OVERRIDE; private: + // Allow the MessageLoop to create a MessageLoopProxyImpl. + friend class ::MessageLoop; + friend class DeleteHelper<MessageLoopProxyImpl>; + MessageLoopProxyImpl(); // Called directly by MessageLoop::~MessageLoop. @@ -55,9 +58,6 @@ class BASE_EXPORT MessageLoopProxyImpl base::TimeDelta delay, bool nestable); - // Allow the messageLoop to create a MessageLoopProxyImpl. - friend class ::MessageLoop; - // The lock that protects access to target_message_loop_. mutable base::Lock message_loop_lock_; MessageLoop* target_message_loop_; diff --git a/base/message_pump.h b/base/message_pump.h index d7aaf0c..16941eb 100644 --- a/base/message_pump.h +++ b/base/message_pump.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -43,7 +43,6 @@ class BASE_EXPORT MessagePump : public RefCountedThreadSafe<MessagePump> { }; MessagePump(); - virtual ~MessagePump(); // The Run method is called to enter the message pump's run loop. // @@ -120,6 +119,10 @@ class BASE_EXPORT MessagePump : public RefCountedThreadSafe<MessagePump> { // cancelling any pending DoDelayedWork callback. This method may only be // used on the thread that called Run. virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) = 0; + + protected: + virtual ~MessagePump(); + friend class RefCountedThreadSafe<MessagePump>; }; } // namespace base diff --git a/base/message_pump_default.h b/base/message_pump_default.h index c16abcf..4efb1c5 100644 --- a/base/message_pump_default.h +++ b/base/message_pump_default.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,7 +15,6 @@ namespace base { class MessagePumpDefault : public MessagePump { public: MessagePumpDefault(); - virtual ~MessagePumpDefault() {} // MessagePump methods: virtual void Run(Delegate* delegate) OVERRIDE; @@ -23,6 +22,9 @@ class MessagePumpDefault : public MessagePump { virtual void ScheduleWork() OVERRIDE; virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) OVERRIDE; + protected: + virtual ~MessagePumpDefault() {} + private: // This flag is set to false when Run should return. bool keep_running_; diff --git a/base/message_pump_libevent.h b/base/message_pump_libevent.h index b12af70..e477036 100644 --- a/base/message_pump_libevent.h +++ b/base/message_pump_libevent.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -100,7 +100,6 @@ class BASE_EXPORT MessagePumpLibevent : public MessagePump { }; MessagePumpLibevent(); - virtual ~MessagePumpLibevent(); // Have the current thread's message loop watch for a a situation in which // reading/writing to the FD can be performed without blocking. @@ -129,6 +128,9 @@ class BASE_EXPORT MessagePumpLibevent : public MessagePump { virtual void ScheduleWork() OVERRIDE; virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) OVERRIDE; + protected: + virtual ~MessagePumpLibevent(); + private: friend class MessagePumpLibeventTest; diff --git a/base/message_pump_mac.h b/base/message_pump_mac.h index baf9071..3d1ac35 100644 --- a/base/message_pump_mac.h +++ b/base/message_pump_mac.h @@ -59,7 +59,6 @@ class MessagePumpCFRunLoopBase : public MessagePump { friend class MessagePumpScopedAutoreleasePool; public: MessagePumpCFRunLoopBase(); - virtual ~MessagePumpCFRunLoopBase(); // Subclasses should implement the work they need to do in MessagePump::Run // in the DoRun method. MessagePumpCFRunLoopBase::Run calls DoRun directly. @@ -72,6 +71,8 @@ class MessagePumpCFRunLoopBase : public MessagePump { virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) OVERRIDE; protected: + virtual ~MessagePumpCFRunLoopBase(); + // Accessors for private data members to be used by subclasses. CFRunLoopRef run_loop() const { return run_loop_; } int nesting_level() const { return nesting_level_; } @@ -194,6 +195,9 @@ class MessagePumpCFRunLoop : public MessagePumpCFRunLoopBase { virtual void DoRun(Delegate* delegate) OVERRIDE; virtual void Quit() OVERRIDE; + protected: + virtual ~MessagePumpCFRunLoop(); + private: virtual void EnterExitRunLoop(CFRunLoopActivity activity) OVERRIDE; @@ -208,11 +212,13 @@ class MessagePumpCFRunLoop : public MessagePumpCFRunLoopBase { class MessagePumpNSRunLoop : public MessagePumpCFRunLoopBase { public: BASE_EXPORT MessagePumpNSRunLoop(); - virtual ~MessagePumpNSRunLoop(); virtual void DoRun(Delegate* delegate) OVERRIDE; virtual void Quit() OVERRIDE; + protected: + virtual ~MessagePumpNSRunLoop(); + private: // A source that doesn't do anything but provide something signalable // attached to the run loop. This source will be signalled when Quit @@ -232,6 +238,9 @@ class MessagePumpNSApplication : public MessagePumpCFRunLoopBase { virtual void DoRun(Delegate* delegate) OVERRIDE; virtual void Quit() OVERRIDE; + protected: + virtual ~MessagePumpNSApplication(); + private: // False after Quit is called. bool keep_running_; @@ -250,6 +259,8 @@ class MessagePumpCrApplication : public MessagePumpNSApplication { MessagePumpCrApplication(); protected: + virtual ~MessagePumpCrApplication() {} + // Returns nil if NSApp is currently in the middle of calling // -sendEvent. Requires NSApp implementing CrAppProtocol. virtual NSAutoreleasePool* CreateAutoreleasePool() OVERRIDE; diff --git a/base/message_pump_mac.mm b/base/message_pump_mac.mm index 0e12b74..e7c422ba 100644 --- a/base/message_pump_mac.mm +++ b/base/message_pump_mac.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -460,6 +460,8 @@ MessagePumpCFRunLoop::MessagePumpCFRunLoop() : quit_pending_(false) { } +MessagePumpCFRunLoop::~MessagePumpCFRunLoop() {} + // Called by MessagePumpCFRunLoopBase::DoRun. If other CFRunLoopRun loops were // running lower on the run loop thread's stack when this object was created, // the same number of CFRunLoopRun loops must be running for the outermost call @@ -542,6 +544,8 @@ MessagePumpNSApplication::MessagePumpNSApplication() running_own_loop_(false) { } +MessagePumpNSApplication::~MessagePumpNSApplication() {} + void MessagePumpNSApplication::DoRun(Delegate* delegate) { bool last_running_own_loop_ = running_own_loop_; diff --git a/base/sequenced_task_runner.h b/base/sequenced_task_runner.h index f44b622..0db9128f 100644 --- a/base/sequenced_task_runner.h +++ b/base/sequenced_task_runner.h @@ -143,7 +143,10 @@ class BASE_EXPORT SequencedTaskRunner : public TaskRunner { this, from_here, object); } -private: + protected: + virtual ~SequencedTaskRunner() {} + + private: template <class T, class R> friend class subtle::DeleteHelperInternal; template <class T, class R> friend class subtle::ReleaseHelperInternal; diff --git a/base/single_thread_task_runner.h b/base/single_thread_task_runner.h index 93f694e..c87e5f7 100644 --- a/base/single_thread_task_runner.h +++ b/base/single_thread_task_runner.h @@ -26,11 +26,14 @@ namespace base { // order that must be run only from the thread the // SingleThreadTaskRunner was created on. class BASE_EXPORT SingleThreadTaskRunner : public SequencedTaskRunner { -public: + public: // A more explicit alias to RunsTasksOnCurrentThread(). bool BelongsToCurrentThread() const { return RunsTasksOnCurrentThread(); } + + protected: + virtual ~SingleThreadTaskRunner() {} }; } // namespace base diff --git a/base/synchronization/waitable_event.h b/base/synchronization/waitable_event.h index 6c91701..018f318 100644 --- a/base/synchronization/waitable_event.h +++ b/base/synchronization/waitable_event.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -145,7 +145,6 @@ class BASE_EXPORT WaitableEvent { public RefCountedThreadSafe<WaitableEventKernel> { public: WaitableEventKernel(bool manual_reset, bool initially_signaled); - virtual ~WaitableEventKernel(); bool Dequeue(Waiter* waiter, void* tag); @@ -153,6 +152,10 @@ class BASE_EXPORT WaitableEvent { const bool manual_reset_; bool signaled_; std::list<Waiter*> waiters_; + + private: + friend class RefCountedThreadSafe<WaitableEventKernel>; + ~WaitableEventKernel(); }; typedef std::pair<WaitableEvent*, size_t> WaiterAndIndex; diff --git a/base/synchronization/waitable_event_watcher_posix.cc b/base/synchronization/waitable_event_watcher_posix.cc index 3b0ba70..5a17999 100644 --- a/base/synchronization/waitable_event_watcher_posix.cc +++ b/base/synchronization/waitable_event_watcher_posix.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -43,8 +43,13 @@ class Flag : public RefCountedThreadSafe<Flag> { } private: + friend class RefCountedThreadSafe<Flag>; + ~Flag() {} + mutable Lock lock_; bool flag_; + + DISALLOW_COPY_AND_ASSIGN(Flag); }; // ----------------------------------------------------------------------------- diff --git a/base/threading/worker_pool_posix.h b/base/threading/worker_pool_posix.h index f56582d..eca113a 100644 --- a/base/threading/worker_pool_posix.h +++ b/base/threading/worker_pool_posix.h @@ -53,7 +53,6 @@ class BASE_EXPORT PosixDynamicThreadPool // |idle_seconds_before_exit|. PosixDynamicThreadPool(const std::string& name_prefix, int idle_seconds_before_exit); - ~PosixDynamicThreadPool(); // Indicates that the thread pool is going away. Stops handing out tasks to // worker threads. Wakes up all the idle threads to let them exit. @@ -68,8 +67,11 @@ class BASE_EXPORT PosixDynamicThreadPool PendingTask WaitForTask(); private: + friend class RefCountedThreadSafe<PosixDynamicThreadPool>; friend class PosixDynamicThreadPoolPeer; + ~PosixDynamicThreadPool(); + // Adds pending_task to the thread pool. This function will clear // |pending_task->task|. void AddTask(PendingTask* pending_task); diff --git a/remoting/base/plugin_message_loop_proxy.h b/remoting/base/plugin_message_loop_proxy.h index 33da94b..23e2c7a 100644 --- a/remoting/base/plugin_message_loop_proxy.h +++ b/remoting/base/plugin_message_loop_proxy.h @@ -27,7 +27,6 @@ class PluginMessageLoopProxy : public base::MessageLoopProxy { // Caller keeps ownership of delegate. PluginMessageLoopProxy(Delegate* delegate); - virtual ~PluginMessageLoopProxy(); void Detach(); @@ -51,6 +50,9 @@ class PluginMessageLoopProxy : public base::MessageLoopProxy { virtual bool RunsTasksOnCurrentThread() const OVERRIDE; + protected: + virtual ~PluginMessageLoopProxy(); + private: static void TaskSpringboard(void* data); diff --git a/webkit/dom_storage/dom_storage_task_runner.h b/webkit/dom_storage/dom_storage_task_runner.h index c7b5fd5..8cb0e79 100644 --- a/webkit/dom_storage/dom_storage_task_runner.h +++ b/webkit/dom_storage/dom_storage_task_runner.h @@ -55,6 +55,9 @@ class DomStorageTaskRunner : public base::TaskRunner { const tracked_objects::Location& from_here, const base::Closure& task, int64 delay_ms) OVERRIDE; + + protected: + virtual ~DomStorageTaskRunner() {} }; // A derived class used in chromium that utilizes a SequenceWorkerPool @@ -78,8 +81,10 @@ class DomStorageWorkerPoolTaskRunner : public DomStorageTaskRunner { SequenceID sequence_id, const base::Closure& task) OVERRIDE; - private: + protected: virtual ~DomStorageWorkerPoolTaskRunner(); + + private: const scoped_refptr<base::MessageLoopProxy> message_loop_; const scoped_refptr<base::SequencedWorkerPool> sequenced_worker_pool_; base::SequencedWorkerPool::SequenceToken primary_sequence_token_; @@ -105,8 +110,10 @@ class MockDomStorageTaskRunner : public DomStorageTaskRunner { SequenceID sequence_id, const base::Closure& task) OVERRIDE; - private: + protected: virtual ~MockDomStorageTaskRunner(); + + private: const scoped_refptr<base::MessageLoopProxy> message_loop_; }; |