1 // Copyright 2016 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_CPP_BINDINGS_INTERFACE_ENDPOINT_CONTROLLER_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_ENDPOINT_CONTROLLER_H_ 7 8 namespace mojo { 9 10 class Message; 11 12 // A control interface exposed by AssociatedGroupController for interface 13 // endpoints. 14 class InterfaceEndpointController { 15 public: ~InterfaceEndpointController()16 virtual ~InterfaceEndpointController() {} 17 18 virtual bool SendMessage(Message* message) = 0; 19 20 // Allows the interface endpoint to watch for incoming sync messages while 21 // others perform sync handle watching on the same sequence. Please see 22 // comments of SyncHandleWatcher::AllowWokenUpBySyncWatchOnSameThread(). 23 virtual void AllowWokenUpBySyncWatchOnSameThread() = 0; 24 25 // Watches the interface endpoint for incoming sync messages. (It also watches 26 // other other handles registered to be watched together.) 27 // This method: 28 // - returns true when |should_stop| is set to true; 29 // - return false otherwise, including 30 // MultiplexRouter::DetachEndpointClient() being called for the same 31 // interface endpoint. 32 virtual bool SyncWatch(const bool* should_stop) = 0; 33 }; 34 35 } // namespace mojo 36 37 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_ENDPOINT_CONTROLLER_H_ 38