| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "media/mojo/services/mojo_media_application_factory.h" | 9 #include "media/mojo/services/mojo_media_application_factory.h" |
| 10 #include "services/shell/public/c/main.h" | 10 #include "services/service_manager/public/c/main.h" |
| 11 #include "services/shell/public/cpp/service_runner.h" | 11 #include "services/service_manager/public/cpp/service_runner.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 shell::ServiceRunner* g_runner = nullptr; | 15 shell::ServiceRunner* g_runner = nullptr; |
| 16 | 16 |
| 17 void QuitApplication() { | 17 void QuitApplication() { |
| 18 DCHECK(g_runner); | 18 DCHECK(g_runner); |
| 19 g_runner->Quit(); | 19 g_runner->Quit(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 MojoResult ServiceMain(MojoHandle mojo_handle) { | 24 MojoResult ServiceMain(MojoHandle mojo_handle) { |
| 25 // Enable logging. | 25 // Enable logging. |
| 26 base::AtExitManager at_exit; | 26 base::AtExitManager at_exit; |
| 27 shell::ServiceRunner::InitBaseCommandLine(); | 27 shell::ServiceRunner::InitBaseCommandLine(); |
| 28 | 28 |
| 29 logging::LoggingSettings settings; | 29 logging::LoggingSettings settings; |
| 30 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 30 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 31 logging::InitLogging(settings); | 31 logging::InitLogging(settings); |
| 32 | 32 |
| 33 std::unique_ptr<shell::Service> service = | 33 std::unique_ptr<shell::Service> service = |
| 34 media::CreateMojoMediaApplication(base::Bind(&QuitApplication)); | 34 media::CreateMojoMediaApplication(base::Bind(&QuitApplication)); |
| 35 shell::ServiceRunner runner(service.release()); | 35 shell::ServiceRunner runner(service.release()); |
| 36 g_runner = &runner; | 36 g_runner = &runner; |
| 37 return runner.Run(mojo_handle, false /* init_base */); | 37 return runner.Run(mojo_handle, false /* init_base */); |
| 38 } | 38 } |
| OLD | NEW |