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 AsyncWaitID AsyncWait(Handle handle, | 20 virtual bool AsyncWait(Handle handle, |
21 MojoWaitFlags flags, | 21 MojoWaitFlags flags, |
22 AsyncWaitCallback* callback) MOJO_OVERRIDE; | 22 MojoDeadline deadline, |
23 virtual void CancelWait(AsyncWaitID async_wait_id) MOJO_OVERRIDE; | 23 AsyncWaitCallback* callback) MOJO_OVERRIDE; |
| 24 virtual void CancelWait(AsyncWaitCallback* callback) MOJO_OVERRIDE; |
24 | 25 |
25 // This method is called by unit tests to check the status of any handles | 26 // This method is called by unit tests to check the status of any handles |
26 // that we are asynchronously waiting on and to dispatch callbacks for any | 27 // that we are asynchronously waiting on and to dispatch callbacks for any |
27 // handles that are ready. | 28 // handles that are ready. |
28 void Process(); | 29 void Process(); |
29 | 30 |
30 private: | 31 private: |
31 bool IsReady(Handle handle, MojoWaitFlags flags, MojoResult* result); | 32 bool IsReady(Handle handle, MojoWaitFlags flags, MojoResult* result); |
32 | 33 |
33 struct Waiter { | 34 struct Waiter { |
34 Handle handle; | 35 Handle handle; |
35 MojoWaitFlags flags; | 36 MojoWaitFlags flags; |
| 37 MojoDeadline deadline; |
36 AsyncWaitCallback* callback; | 38 AsyncWaitCallback* callback; |
37 }; | 39 }; |
38 | 40 |
39 typedef std::list<Waiter*> WaiterList; | 41 std::list<Waiter> waiters_; |
40 WaiterList waiters_; | |
41 }; | 42 }; |
42 | 43 |
43 } // namespace test | 44 } // namespace test |
44 } // namespace mojo | 45 } // namespace mojo |
45 | 46 |
46 #endif // MOJO_PUBLIC_TESTS_SIMPLE_BINDINGS_SUPPORT_H_ | 47 #endif // MOJO_PUBLIC_TESTS_SIMPLE_BINDINGS_SUPPORT_H_ |
OLD | NEW |