summaryrefslogtreecommitdiffstats
path: root/base/object_watcher.h
diff options
context:
space:
mode:
authordarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-05 23:16:41 +0000
committerdarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-05 23:16:41 +0000
commit2a1272586d0ab6719820ea25ac596683b33d0676 (patch)
tree3f0203f0cc289e067d9668d73265832e5ecf6742 /base/object_watcher.h
parent836dff30efbff95f2090a024da25debe4edd2f83 (diff)
downloadchromium_src-2a1272586d0ab6719820ea25ac596683b33d0676.zip
chromium_src-2a1272586d0ab6719820ea25ac596683b33d0676.tar.gz
chromium_src-2a1272586d0ab6719820ea25ac596683b33d0676.tar.bz2
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
Diffstat (limited to 'base/object_watcher.h')
-rw-r--r--base/object_watcher.h7
1 files changed, 5 insertions, 2 deletions
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 <windows.h>
-#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_;