| 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 |
| 80 private: | 83 private: |
| 81 class MessageLoopObserver; | 84 class MessageLoopObserver; |
| 82 friend class MessageLoopObserver; | 85 friend class MessageLoopObserver; |
| 83 | 86 |
| 84 void OnHandleReady(MojoResult result); | 87 void OnHandleReady(MojoResult result); |
| 85 | 88 |
| 86 static void CallOnHandleReady(uintptr_t context, | 89 static void CallOnHandleReady(uintptr_t context, |
| 87 MojoResult result, | 90 MojoResult result, |
| 88 MojoHandleSignalsState signals_state, | 91 MojoHandleSignalsState signals_state, |
| 89 MojoWatchNotificationFlags flags); | 92 MojoWatchNotificationFlags flags); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 113 ReadyCallback callback_; | 116 ReadyCallback callback_; |
| 114 | 117 |
| 115 base::WeakPtrFactory<Watcher> weak_factory_; | 118 base::WeakPtrFactory<Watcher> weak_factory_; |
| 116 | 119 |
| 117 DISALLOW_COPY_AND_ASSIGN(Watcher); | 120 DISALLOW_COPY_AND_ASSIGN(Watcher); |
| 118 }; | 121 }; |
| 119 | 122 |
| 120 } // namespace mojo | 123 } // namespace mojo |
| 121 | 124 |
| 122 #endif // MOJO_PUBLIC_CPP_SYSTEM_WATCHER_H_ | 125 #endif // MOJO_PUBLIC_CPP_SYSTEM_WATCHER_H_ |
| OLD | NEW |