| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/application/application_runner_chromium.h" | 5 #include "mojo/application/application_runner_chromium.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/stack_trace.h" |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 11 #include "mojo/common/message_pump_mojo.h" | 12 #include "mojo/common/message_pump_mojo.h" |
| 12 #include "mojo/public/cpp/application/application_delegate.h" | 13 #include "mojo/public/cpp/application/application_delegate.h" |
| 13 #include "mojo/public/cpp/application/application_impl.h" | 14 #include "mojo/public/cpp/application/application_impl.h" |
| 14 | 15 |
| 15 namespace mojo { | 16 namespace mojo { |
| 16 | 17 |
| 17 // static | 18 // static |
| 18 void ApplicationImpl::Terminate() { | 19 void ApplicationImpl::Terminate() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 38 | 39 |
| 39 MojoResult ApplicationRunnerChromium::Run(MojoHandle shell_handle) { | 40 MojoResult ApplicationRunnerChromium::Run(MojoHandle shell_handle) { |
| 40 DCHECK(!has_run_); | 41 DCHECK(!has_run_); |
| 41 has_run_ = true; | 42 has_run_ = true; |
| 42 | 43 |
| 43 base::CommandLine::Init(0, NULL); | 44 base::CommandLine::Init(0, NULL); |
| 44 #if !defined(COMPONENT_BUILD) | 45 #if !defined(COMPONENT_BUILD) |
| 45 base::AtExitManager at_exit; | 46 base::AtExitManager at_exit; |
| 46 #endif | 47 #endif |
| 47 | 48 |
| 49 #ifndef NDEBUG |
| 50 base::debug::EnableInProcessStackDumping(); |
| 51 #endif |
| 52 |
| 48 { | 53 { |
| 49 scoped_ptr<base::MessageLoop> loop; | 54 scoped_ptr<base::MessageLoop> loop; |
| 50 if (message_loop_type_ == base::MessageLoop::TYPE_CUSTOM) | 55 if (message_loop_type_ == base::MessageLoop::TYPE_CUSTOM) |
| 51 loop.reset(new base::MessageLoop(common::MessagePumpMojo::Create())); | 56 loop.reset(new base::MessageLoop(common::MessagePumpMojo::Create())); |
| 52 else | 57 else |
| 53 loop.reset(new base::MessageLoop(message_loop_type_)); | 58 loop.reset(new base::MessageLoop(message_loop_type_)); |
| 54 | 59 |
| 55 ApplicationImpl impl(delegate_.get(), | 60 ApplicationImpl impl(delegate_.get(), |
| 56 MakeScopedHandle(MessagePipeHandle(shell_handle))); | 61 MakeScopedHandle(MessagePipeHandle(shell_handle))); |
| 57 loop->Run(); | 62 loop->Run(); |
| 58 } | 63 } |
| 59 delegate_.reset(); | 64 delegate_.reset(); |
| 60 return MOJO_RESULT_OK; | 65 return MOJO_RESULT_OK; |
| 61 } | 66 } |
| 62 | 67 |
| 63 } // namespace mojo | 68 } // namespace mojo |
| OLD | NEW |