summaryrefslogtreecommitdiff
path: root/chromium/media/mojo/services/main.cc
blob: 09af756828e1a9b5a28396bf7744e453ffc21e32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/at_exit.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "media/mojo/services/media_service_factory.h"
#include "services/service_manager/public/c/main.h"
#include "services/service_manager/public/cpp/service_runner.h"

MojoResult ServiceMain(MojoHandle mojo_handle) {
  // Enable logging.
  base::AtExitManager at_exit;
  service_manager::ServiceRunner::InitBaseCommandLine();

  logging::LoggingSettings settings;
  settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
  logging::InitLogging(settings);

  std::unique_ptr<service_manager::Service> service =
      media::CreateMediaServiceForTesting();
  service_manager::ServiceRunner runner(service.release());
  return runner.Run(mojo_handle, false /* init_base */);
}