| Index: mojo/public/cpp/system/watcher.h
|
| diff --git a/mojo/public/cpp/system/watcher.h b/mojo/public/cpp/system/watcher.h
|
| index 815b73b3b50b1d7dc71bbb465587862a2aeb2301..3284154b2d886d97b9ecbde4e23e2255ce121077 100644
|
| --- a/mojo/public/cpp/system/watcher.h
|
| +++ b/mojo/public/cpp/system/watcher.h
|
| @@ -4,6 +4,8 @@
|
|
|
| #ifndef MOJO_PUBLIC_CPP_SYSTEM_WATCHER_H_
|
| #define MOJO_PUBLIC_CPP_SYSTEM_WATCHER_H_
|
| +
|
| +#include <memory>
|
|
|
| #include "base/callback.h"
|
| #include "base/macros.h"
|
| @@ -34,6 +36,11 @@
|
| //
|
| // |MOJO_RESULT_CANCELLED|: The handle has been closed and the watch has
|
| // been cancelled implicitly.
|
| + //
|
| + // |MOJO_RESULT_ABORTED|: Notifications can no longer be delivered for this
|
| + // watcher for some unspecified reason, e.g., the watching thread may
|
| + // be shutting down soon. Note that it is still necessary to explicitly
|
| + // Cancel() the watch in this case.
|
| using ReadyCallback = base::Callback<void(MojoResult result)>;
|
|
|
| explicit Watcher(scoped_refptr<base::SingleThreadTaskRunner> runner =
|
| @@ -75,6 +82,9 @@
|
| ReadyCallback ready_callback() const { return callback_; }
|
|
|
| private:
|
| + class MessageLoopObserver;
|
| + friend class MessageLoopObserver;
|
| +
|
| void OnHandleReady(MojoResult result);
|
|
|
| static void CallOnHandleReady(uintptr_t context,
|
| @@ -90,6 +100,8 @@
|
| // Whether |task_runner_| is the same as base::ThreadTaskRunnerHandle::Get()
|
| // for the thread.
|
| const bool is_default_task_runner_;
|
| +
|
| + std::unique_ptr<MessageLoopObserver> message_loop_observer_;
|
|
|
| // A persistent weak reference to this Watcher which can be passed to the
|
| // Dispatcher any time this object should be signalled. Safe to access (but
|
|
|