From 2a1272586d0ab6719820ea25ac596683b33d0676 Mon Sep 17 00:00:00 2001 From: "darin@google.com" Date: Tue, 5 Aug 2008 23:16:41 +0000 Subject: ObjectWatcher needs to know when the current thread's MessageLoop is being destroyed. This might also be generically useful, so I added a new API on ML to observe when the ML is being destroyed. The notification is sent to observers just prior to ML::current() being modified to return NULL. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@407 0039d316-1c4b-4281-b951-d872f2087c98 --- base/object_watcher.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'base/object_watcher.h') diff --git a/base/object_watcher.h b/base/object_watcher.h index de4816a..9058ab4 100644 --- a/base/object_watcher.h +++ b/base/object_watcher.h @@ -32,7 +32,7 @@ #include -#include "base/basictypes.h" +#include "base/message_loop.h" namespace base { @@ -64,7 +64,7 @@ namespace base { // scope, the watcher_ will be destroyed, and there is no need to worry about // OnObjectSignaled being called on a deleted MyClass pointer. Easy! // -class ObjectWatcher { +class ObjectWatcher : public MessageLoop::DestructionObserver { public: class Delegate { public: @@ -97,6 +97,9 @@ class ObjectWatcher { // Called on a background thread when done waiting. static void CALLBACK DoneWaiting(void* param, BOOLEAN timed_out); + // MessageLoop::DestructionObserver implementation: + virtual void WillDestroyCurrentMessageLoop(); + // Internal state. struct Watch; Watch* watch_; -- cgit v1.1