OLD | NEW |
(Empty) | |
| 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 #include "mojo/public/cpp/application/run_application.h" |
| 6 |
| 7 #include "mojo/public/cpp/application/application_impl_base.h" |
| 8 #include "mojo/public/cpp/system/message_pipe.h" |
| 9 #include "mojo/public/cpp/utility/run_loop.h" |
| 10 #include "mojo/public/interfaces/application/application.mojom.h" |
| 11 |
| 12 namespace mojo { |
| 13 |
| 14 void RunApplication(MojoHandle application_request_handle, |
| 15 ApplicationImplBase* application_impl) { |
| 16 // TODO(vtl): Possibly we should have an assertion that we're not running, but |
| 17 // that requires TLS. |
| 18 |
| 19 RunLoop loop; |
| 20 application_impl->Bind(InterfaceRequest<Application>( |
| 21 MakeScopedHandle(MessagePipeHandle(application_request_handle)))); |
| 22 loop.Run(); |
| 23 |
| 24 // TODO(vtl): Should we unbind stuff here? (Should there be "will start"/"did |
| 25 // stop" notifications to the |ApplicationImplBase|?) |
| 26 } |
| 27 |
| 28 void TerminateApplication() { |
| 29 RunLoop::current()->Quit(); |
| 30 } |
| 31 |
| 32 } // namespace mojo |
OLD | NEW |