This sets up API to release OutputSurface from LTHClient.
[chromium-blink-merge.git] / media / mojo / services / mojo_media_application.cc
blob566f43f3640487ce94ada3062d6b9d9d1fe94942
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.
5 #include "media/mojo/services/mojo_media_application.h"
7 #include "base/logging.h"
8 #include "media/base/media_log.h"
9 #include "media/mojo/services/service_factory_impl.h"
10 #include "mojo/application/public/cpp/application_connection.h"
11 #include "mojo/application/public/cpp/application_impl.h"
13 namespace media {
15 const char kMojoMediaAppUrl[] = "mojo:media";
17 // static
18 GURL MojoMediaApplication::AppUrl() {
19 return GURL(kMojoMediaAppUrl);
22 // static
23 scoped_ptr<mojo::ApplicationDelegate> MojoMediaApplication::CreateApp() {
24 return scoped_ptr<mojo::ApplicationDelegate>(new MojoMediaApplication());
27 // TODO(xhwang): Hook up MediaLog when possible.
28 MojoMediaApplication::MojoMediaApplication()
29 : app_impl_(nullptr), media_log_(new MediaLog()) {}
31 MojoMediaApplication::~MojoMediaApplication() {
34 void MojoMediaApplication::Initialize(mojo::ApplicationImpl* app) {
35 app_impl_ = app;
37 logging::LoggingSettings settings;
38 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
39 logging::InitLogging(settings);
40 // Display process ID, thread ID and timestamp in logs.
41 logging::SetLogItems(true, true, true, false);
44 bool MojoMediaApplication::ConfigureIncomingConnection(
45 mojo::ApplicationConnection* connection) {
46 connection->AddService<interfaces::ServiceFactory>(this);
47 return true;
50 void MojoMediaApplication::Create(
51 mojo::ApplicationConnection* connection,
52 mojo::InterfaceRequest<interfaces::ServiceFactory> request) {
53 // The created object is owned by the pipe.
54 new ServiceFactoryImpl(request.Pass(), connection->GetServiceProvider(),
55 media_log_,
56 app_impl_->app_lifetime_helper()->CreateAppRefCount());
59 } // namespace media