OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MOJO_PUBLIC_TESTS_SIMPLE_BINDINGS_SUPPORT_H_ |
| 6 #define MOJO_PUBLIC_TESTS_SIMPLE_BINDINGS_SUPPORT_H_ |
| 7 |
| 8 #include <list> |
| 9 |
| 10 #include "mojo/public/bindings/lib/bindings_support.h" |
| 11 |
| 12 namespace mojo { |
| 13 namespace test { |
| 14 |
| 15 class SimpleBindingsSupport : public BindingsSupport { |
| 16 public: |
| 17 SimpleBindingsSupport(); |
| 18 virtual ~SimpleBindingsSupport(); |
| 19 |
| 20 virtual bool AsyncWait(Handle handle, |
| 21 MojoWaitFlags flags, |
| 22 MojoDeadline deadline, |
| 23 AsyncWaitCallback* callback) MOJO_OVERRIDE; |
| 24 virtual void CancelWait(AsyncWaitCallback* callback) MOJO_OVERRIDE; |
| 25 |
| 26 // 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 |
| 28 // handles that are ready. |
| 29 void Process(); |
| 30 |
| 31 private: |
| 32 bool IsReady(Handle handle, MojoWaitFlags flags, MojoResult* result); |
| 33 |
| 34 struct Waiter { |
| 35 Handle handle; |
| 36 MojoWaitFlags flags; |
| 37 MojoDeadline deadline; |
| 38 AsyncWaitCallback* callback; |
| 39 }; |
| 40 |
| 41 std::list<Waiter> waiters_; |
| 42 }; |
| 43 |
| 44 } // namespace test |
| 45 } // namespace mojo |
| 46 |
| 47 #endif // MOJO_PUBLIC_TESTS_SIMPLE_BINDINGS_SUPPORT_H_ |
OLD | NEW |