OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 "base/at_exit.h" | |
6 #include "base/command_line.h" | |
7 #include "base/message_loop/message_loop.h" | |
8 #include "mojo/public/cpp/application/application_delegate.h" | |
9 #include "mojo/public/cpp/application/application_impl.h" | |
10 | |
11 extern "C" APPLICATION_EXPORT MojoResult CDECL MojoMain( | |
12 MojoHandle shell_handle) { | |
13 base::CommandLine::Init(0, NULL); | |
14 #if !defined(COMPONENT_BUILD) | |
15 base::AtExitManager at_exit; | |
16 #endif | |
17 scoped_ptr<mojo::ApplicationDelegate> delegate; | |
18 { | |
19 // We have to shut down the MessageLoop before destroying the | |
20 // ApplicationDelegate. | |
21 base::MessageLoop loop; | |
22 delegate.reset(mojo::ApplicationDelegate::Create()); | |
23 mojo::ApplicationImpl app(delegate.get()); | |
24 app.BindShell(shell_handle); | |
25 loop.Run(); | |
26 } | |
27 | |
28 return MOJO_RESULT_OK; | |
29 } | |
OLD | NEW |