| 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_MESSAGE_PUMP_HANDLE_WATCHER_H_ | 5 #ifndef MOJO_MESSAGE_PUMP_HANDLE_WATCHER_H_ |
| 6 #define MOJO_MESSAGE_PUMP_HANDLE_WATCHER_H_ | 6 #define MOJO_MESSAGE_PUMP_HANDLE_WATCHER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 12 #include "mojo/public/c/system/time.h" | 13 #include "mojo/public/c/system/time.h" |
| 13 #include "mojo/public/cpp/system/handle.h" | 14 #include "mojo/public/cpp/system/handle.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class Thread; | 17 class Thread; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace mojo { | 20 namespace mojo { |
| 20 namespace common { | 21 namespace common { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 45 | 46 |
| 46 // Stops listening. Does nothing if not in the process of listening. Blocks | 47 // Stops listening. Does nothing if not in the process of listening. Blocks |
| 47 // until no longer listening on the handle. | 48 // until no longer listening on the handle. |
| 48 void Stop(); | 49 void Stop(); |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 class StateBase; | 52 class StateBase; |
| 52 class SameThreadWatchingState; | 53 class SameThreadWatchingState; |
| 53 class SecondaryThreadWatchingState; | 54 class SecondaryThreadWatchingState; |
| 54 | 55 |
| 55 // If non-NULL Start() has been invoked. | 56 // If non-null, Start() has been invoked. |
| 56 scoped_ptr<StateBase> state_; | 57 std::unique_ptr<StateBase> state_; |
| 57 | 58 |
| 58 DISALLOW_COPY_AND_ASSIGN(HandleWatcher); | 59 DISALLOW_COPY_AND_ASSIGN(HandleWatcher); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 } // namespace common | 62 } // namespace common |
| 62 } // namespace mojo | 63 } // namespace mojo |
| 63 | 64 |
| 64 #endif // MOJO_MESSAGE_PUMP_HANDLE_WATCHER_H_ | 65 #endif // MOJO_MESSAGE_PUMP_HANDLE_WATCHER_H_ |
| OLD | NEW |