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_UTILITY_BINDINGS_SUPPORT_IMPL_H_ 6 #define MOJO_PUBLIC_UTILITY_BINDINGS_SUPPORT_IMPL_H_ 7 8 #include "mojo/public/bindings/lib/bindings_support.h" 9 #include "mojo/public/system/macros.h" 10 11 namespace mojo { 12 namespace utility { 13 namespace internal { 14 15 // BindingsSupport implementation that uses RunLoop. Before using this you must 16 // have created a RunLoop on the current thread. 17 // You shouldn't create this directly, instead use Environment. 18 class BindingsSupportImpl : public BindingsSupport { 19 public: 20 BindingsSupportImpl(); 21 virtual ~BindingsSupportImpl(); 22 23 // Sets up state needed for BindingsSupportImpl. This must be invoked before 24 // creating a BindingsSupportImpl. 25 static void SetUp(); 26 27 // Cleans state created by Setup(). 28 static void TearDown(); 29 30 // BindingsSupport methods: 31 virtual Buffer* GetCurrentBuffer() MOJO_OVERRIDE; 32 virtual Buffer* SetCurrentBuffer(Buffer* buf) MOJO_OVERRIDE; 33 virtual AsyncWaitID AsyncWait(const Handle& handle, 34 MojoWaitFlags flags, 35 AsyncWaitCallback* callback) MOJO_OVERRIDE; 36 virtual void CancelWait(AsyncWaitID async_wait_id) MOJO_OVERRIDE; 37 38 private: 39 MOJO_DISALLOW_COPY_AND_ASSIGN(BindingsSupportImpl); 40 }; 41 42 } // namespace internal 43 } // namespace utility 44 } // namespace mojo 45 46 #endif // MOJO_PUBLIC_UTILITY_BINDINGS_SUPPORT_IMPL_H_ 47