Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Side by Side Diff: mojo/public/cpp/application/lib/run_application.cc

Issue 2004493002: Add a mojo::RunApplication() for running implementations of ApplicationImplBase. (Closed) Base URL: https://github.com/domokit/mojo.git@work790_environment_no_instantiate
Patch Set: rebased Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW
« no previous file with comments | « mojo/public/cpp/application/lib/application_impl_base.cc ('k') | mojo/public/cpp/application/run_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698