// Run binds your mojo application to provided message pipe handle and runs it // until the application is terminated. func Run(delegate Delegate, applicationRequest system.MojoHandle) { messagePipe := system.GetCore().AcquireNativeHandle(applicationRequest).ToMessagePipeHandle() appRequest := application.Application_Request{bindings.NewMessagePipeHandleOwner(messagePipe)} impl := &ApplicationImpl{ delegate: delegate, } stub := application.NewApplicationStub(appRequest, impl, bindings.GetAsyncWaiter()) impl.runner = stub for { if err := stub.ServeRequest(); err != nil { connectionError, ok := err.(*bindings.ConnectionError) if !ok || !connectionError.Closed() { log.Println(err) } impl.RequestQuit() break } } }
func pipeOwner(h system.MessagePipeHandle) bindings.MessagePipeHandleOwner { return bindings.NewMessagePipeHandleOwner(h) }