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.h" 9 10 extern "C" APPLICATION_EXPORT MojoResult CDECL MojoMain( 11 MojoHandle service_provider_handle) { 12 base::CommandLine::Init(0, NULL); 13 base::AtExitManager at_exit; 14 base::MessageLoop loop; 15 16 scoped_ptr<mojo::Application> app(mojo::Application::Create()); 17 app->BindServiceProvider( 18 mojo::MakeScopedHandle(mojo::MessagePipeHandle(service_provider_handle))); 19 app->Initialize(); 20 loop.Run(); 21 22 return MOJO_RESULT_OK; 23 } 24