| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_COMMON_HANDLE_WATCHER_H_ | 5 #ifndef MOJO_COMMON_HANDLE_WATCHER_H_ |
| 6 #define MOJO_COMMON_HANDLE_WATCHER_H_ | 6 #define MOJO_COMMON_HANDLE_WATCHER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 void Start(const Handle& handle, | 41 void Start(const Handle& handle, |
| 42 MojoHandleSignals handle_signals, | 42 MojoHandleSignals handle_signals, |
| 43 MojoDeadline deadline, | 43 MojoDeadline deadline, |
| 44 const base::Callback<void(MojoResult)>& callback); | 44 const base::Callback<void(MojoResult)>& callback); |
| 45 | 45 |
| 46 // Stops listening. Does nothing if not in the process of listening. Blocks | 46 // Stops listening. Does nothing if not in the process of listening. Blocks |
| 47 // until no longer listening on the handle. | 47 // until no longer listening on the handle. |
| 48 void Stop(); | 48 void Stop(); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 class State; | 51 class StateBase; |
| 52 class SameThreadWatchingState; |
| 53 class SecondaryThreadWatchingState; |
| 52 | 54 |
| 53 // If non-NULL Start() has been invoked. | 55 // If non-NULL Start() has been invoked. |
| 54 scoped_ptr<State> state_; | 56 scoped_ptr<StateBase> state_; |
| 55 | 57 |
| 56 DISALLOW_COPY_AND_ASSIGN(HandleWatcher); | 58 DISALLOW_COPY_AND_ASSIGN(HandleWatcher); |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 } // namespace common | 61 } // namespace common |
| 60 } // namespace mojo | 62 } // namespace mojo |
| 61 | 63 |
| 62 #endif // MOJO_COMMON_HANDLE_WATCHER_H_ | 64 #endif // MOJO_COMMON_HANDLE_WATCHER_H_ |
| OLD | NEW |