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