| 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/public/cpp/application_runner.h" | 5 #include "mojo/application/public/cpp/application_runner.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/debug/stack_trace.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/process/launch.h" |
| 12 #include "base/threading/worker_pool.h" | 13 #include "base/threading/worker_pool.h" |
| 13 #include "mojo/application/public/cpp/application_delegate.h" | 14 #include "mojo/application/public/cpp/application_delegate.h" |
| 14 #include "mojo/application/public/cpp/application_impl.h" | 15 #include "mojo/application/public/cpp/application_impl.h" |
| 15 #include "mojo/message_pump/message_pump_mojo.h" | 16 #include "mojo/message_pump/message_pump_mojo.h" |
| 16 | 17 |
| 17 namespace mojo { | 18 namespace mojo { |
| 18 | 19 |
| 19 int g_application_runner_argc; | 20 int g_application_runner_argc; |
| 20 const char* const* g_application_runner_argv; | 21 const char* const* g_application_runner_argv; |
| 21 | 22 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 39 | 40 |
| 40 MojoResult ApplicationRunner::Run(MojoHandle application_request_handle, | 41 MojoResult ApplicationRunner::Run(MojoHandle application_request_handle, |
| 41 bool init_base) { | 42 bool init_base) { |
| 42 DCHECK(!has_run_); | 43 DCHECK(!has_run_); |
| 43 has_run_ = true; | 44 has_run_ = true; |
| 44 | 45 |
| 45 scoped_ptr<base::AtExitManager> at_exit; | 46 scoped_ptr<base::AtExitManager> at_exit; |
| 46 if (init_base) { | 47 if (init_base) { |
| 47 InitBaseCommandLine(); | 48 InitBaseCommandLine(); |
| 48 at_exit.reset(new base::AtExitManager); | 49 at_exit.reset(new base::AtExitManager); |
| 49 #ifndef NDEBUG | 50 #ifndef OFFICIAL_BUILD |
| 50 base::debug::EnableInProcessStackDumping(); | 51 base::debug::EnableInProcessStackDumping(); |
| 52 #if defined(OS_WIN) |
| 53 base::RouteStdioToConsole(false); |
| 54 #endif |
| 51 #endif | 55 #endif |
| 52 } | 56 } |
| 53 | 57 |
| 54 { | 58 { |
| 55 scoped_ptr<base::MessageLoop> loop; | 59 scoped_ptr<base::MessageLoop> loop; |
| 56 if (message_loop_type_ == base::MessageLoop::TYPE_CUSTOM) | 60 if (message_loop_type_ == base::MessageLoop::TYPE_CUSTOM) |
| 57 loop.reset(new base::MessageLoop(common::MessagePumpMojo::Create())); | 61 loop.reset(new base::MessageLoop(common::MessagePumpMojo::Create())); |
| 58 else | 62 else |
| 59 loop.reset(new base::MessageLoop(message_loop_type_)); | 63 loop.reset(new base::MessageLoop(message_loop_type_)); |
| 60 | 64 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 79 base::WorkerPool::ShutDownCleanly(); | 83 base::WorkerPool::ShutDownCleanly(); |
| 80 | 84 |
| 81 return MOJO_RESULT_OK; | 85 return MOJO_RESULT_OK; |
| 82 } | 86 } |
| 83 | 87 |
| 84 MojoResult ApplicationRunner::Run(MojoHandle application_request_handle) { | 88 MojoResult ApplicationRunner::Run(MojoHandle application_request_handle) { |
| 85 return Run(application_request_handle, true); | 89 return Run(application_request_handle, true); |
| 86 } | 90 } |
| 87 | 91 |
| 88 } // namespace mojo | 92 } // namespace mojo |
| OLD | NEW |