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_PUBLIC_UTILITY_RUN_LOOP_H_ | 5 #ifndef MOJO_PUBLIC_UTILITY_RUN_LOOP_H_ |
6 #define MOJO_PUBLIC_UTILITY_RUN_LOOP_H_ | 6 #define MOJO_PUBLIC_UTILITY_RUN_LOOP_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "mojo/public/system/core_cpp.h" | 10 #include "mojo/public/system/core_cpp.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // created. | 30 // created. |
31 static RunLoop* current(); | 31 static RunLoop* current(); |
32 | 32 |
33 // Registers a RunLoopHandler for the specified handle. Only one handler can | 33 // Registers a RunLoopHandler for the specified handle. Only one handler can |
34 // be registered for a specified handle. | 34 // be registered for a specified handle. |
35 void AddHandler(RunLoopHandler* handler, | 35 void AddHandler(RunLoopHandler* handler, |
36 const Handle& handle, | 36 const Handle& handle, |
37 MojoWaitFlags wait_flags, | 37 MojoWaitFlags wait_flags, |
38 MojoDeadline deadline); | 38 MojoDeadline deadline); |
39 void RemoveHandler(const Handle& handle); | 39 void RemoveHandler(const Handle& handle); |
| 40 bool HasHandler(const Handle& handle) const; |
40 | 41 |
41 // Runs the loop servicing handles as they are ready. This returns when Quit() | 42 // Runs the loop servicing handles as they are ready. This returns when Quit() |
42 // is invoked, or there no more handles. | 43 // is invoked, or there no more handles. |
43 void Run(); | 44 void Run(); |
44 void Quit(); | 45 void Quit(); |
45 | 46 |
46 private: | 47 private: |
47 struct RunState; | 48 struct RunState; |
48 struct WaitState; | 49 struct WaitState; |
49 | 50 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // notify it. | 92 // notify it. |
92 int next_handler_id_; | 93 int next_handler_id_; |
93 | 94 |
94 MOJO_DISALLOW_COPY_AND_ASSIGN(RunLoop); | 95 MOJO_DISALLOW_COPY_AND_ASSIGN(RunLoop); |
95 }; | 96 }; |
96 | 97 |
97 } // namespace utility | 98 } // namespace utility |
98 } // namespace mojo | 99 } // namespace mojo |
99 | 100 |
100 #endif // MOJO_PUBLIC_UTILITY_RUN_LOOP_H_ | 101 #endif // MOJO_PUBLIC_UTILITY_RUN_LOOP_H_ |
OLD | NEW |