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_TESTS_SIMPLE_BINDINGS_SUPPORT_H_ | 5 #ifndef MOJO_PUBLIC_TESTS_SIMPLE_BINDINGS_SUPPORT_H_ |
6 #define MOJO_PUBLIC_TESTS_SIMPLE_BINDINGS_SUPPORT_H_ | 6 #define MOJO_PUBLIC_TESTS_SIMPLE_BINDINGS_SUPPORT_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "mojo/public/bindings/lib/bindings_support.h" | 10 #include "mojo/public/bindings/lib/bindings_support.h" |
11 | 11 |
12 namespace mojo { | 12 namespace mojo { |
13 namespace test { | 13 namespace test { |
14 | 14 |
15 class SimpleBindingsSupport : public BindingsSupport { | 15 class SimpleBindingsSupport : public BindingsSupport { |
16 public: | 16 public: |
17 SimpleBindingsSupport(); | 17 SimpleBindingsSupport(); |
18 virtual ~SimpleBindingsSupport(); | 18 virtual ~SimpleBindingsSupport(); |
19 | 19 |
20 virtual bool AsyncWait(Handle handle, | 20 virtual AsyncWaitID AsyncWait(Handle handle, |
21 MojoWaitFlags flags, | 21 MojoWaitFlags flags, |
22 MojoDeadline deadline, | 22 AsyncWaitCallback* callback) MOJO_OVERRIDE; |
23 AsyncWaitCallback* callback) MOJO_OVERRIDE; | 23 virtual void CancelWait(AsyncWaitID async_wait_id) MOJO_OVERRIDE; |
24 virtual void CancelWait(AsyncWaitCallback* callback) MOJO_OVERRIDE; | |
25 | 24 |
26 // This method is called by unit tests to check the status of any handles | 25 // This method is called by unit tests to check the status of any handles |
27 // that we are asynchronously waiting on and to dispatch callbacks for any | 26 // that we are asynchronously waiting on and to dispatch callbacks for any |
28 // handles that are ready. | 27 // handles that are ready. |
29 void Process(); | 28 void Process(); |
30 | 29 |
31 private: | 30 private: |
32 bool IsReady(Handle handle, MojoWaitFlags flags, MojoResult* result); | 31 bool IsReady(Handle handle, MojoWaitFlags flags, MojoResult* result); |
33 | 32 |
34 struct Waiter { | 33 struct Waiter { |
35 Handle handle; | 34 Handle handle; |
36 MojoWaitFlags flags; | 35 MojoWaitFlags flags; |
37 MojoDeadline deadline; | |
38 AsyncWaitCallback* callback; | 36 AsyncWaitCallback* callback; |
39 }; | 37 }; |
40 | 38 |
41 std::list<Waiter> waiters_; | 39 typedef std::list<Waiter*> WaiterList; |
| 40 WaiterList waiters_; |
42 }; | 41 }; |
43 | 42 |
44 } // namespace test | 43 } // namespace test |
45 } // namespace mojo | 44 } // namespace mojo |
46 | 45 |
47 #endif // MOJO_PUBLIC_TESTS_SIMPLE_BINDINGS_SUPPORT_H_ | 46 #endif // MOJO_PUBLIC_TESTS_SIMPLE_BINDINGS_SUPPORT_H_ |
OLD | NEW |