| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef MOJO_PUBLIC_CPP_SYSTEM_WATCHER_H_ | 5 #ifndef MOJO_PUBLIC_CPP_SYSTEM_WATCHER_H_ |
| 6 #define MOJO_PUBLIC_CPP_SYSTEM_WATCHER_H_ | 6 #define MOJO_PUBLIC_CPP_SYSTEM_WATCHER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // | 70 // |
| 71 // Destroying the Watcher implicitly calls |Cancel()|. | 71 // Destroying the Watcher implicitly calls |Cancel()|. |
| 72 MojoResult Start(Handle handle, | 72 MojoResult Start(Handle handle, |
| 73 MojoHandleSignals signals, | 73 MojoHandleSignals signals, |
| 74 const ReadyCallback& callback); | 74 const ReadyCallback& callback); |
| 75 | 75 |
| 76 // Cancels the current watch. Once this returns, the callback previously | 76 // Cancels the current watch. Once this returns, the callback previously |
| 77 // passed to |Start()| will never be called again for this Watcher. | 77 // passed to |Start()| will never be called again for this Watcher. |
| 78 void Cancel(); | 78 void Cancel(); |
| 79 | 79 |
| 80 Handle handle() const { return handle_; } | |
| 81 ReadyCallback ready_callback() const { return callback_; } | |
| 82 | |
| 83 private: | 80 private: |
| 84 class MessageLoopObserver; | 81 class MessageLoopObserver; |
| 85 friend class MessageLoopObserver; | 82 friend class MessageLoopObserver; |
| 86 | 83 |
| 87 void OnHandleReady(MojoResult result); | 84 void OnHandleReady(MojoResult result); |
| 88 | 85 |
| 89 static void CallOnHandleReady(uintptr_t context, | 86 static void CallOnHandleReady(uintptr_t context, |
| 90 MojoResult result, | 87 MojoResult result, |
| 91 MojoHandleSignalsState signals_state, | 88 MojoHandleSignalsState signals_state, |
| 92 MojoWatchNotificationFlags flags); | 89 MojoWatchNotificationFlags flags); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 116 ReadyCallback callback_; | 113 ReadyCallback callback_; |
| 117 | 114 |
| 118 base::WeakPtrFactory<Watcher> weak_factory_; | 115 base::WeakPtrFactory<Watcher> weak_factory_; |
| 119 | 116 |
| 120 DISALLOW_COPY_AND_ASSIGN(Watcher); | 117 DISALLOW_COPY_AND_ASSIGN(Watcher); |
| 121 }; | 118 }; |
| 122 | 119 |
| 123 } // namespace mojo | 120 } // namespace mojo |
| 124 | 121 |
| 125 #endif // MOJO_PUBLIC_CPP_SYSTEM_WATCHER_H_ | 122 #endif // MOJO_PUBLIC_CPP_SYSTEM_WATCHER_H_ |
| OLD | NEW |