| 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 "media/mojo/services/media_service.h" | 5 #include "media/mojo/services/media_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "media/base/media_log.h" | 10 #include "media/base/media_log.h" |
| 11 #include "media/mojo/services/interface_factory_impl.h" | 11 #include "media/mojo/services/interface_factory_impl.h" |
| 12 #include "media/mojo/services/mojo_media_client.h" | 12 #include "media/mojo/services/mojo_media_client.h" |
| 13 #include "mojo/public/cpp/bindings/strong_binding.h" | 13 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 14 #include "services/service_manager/public/cpp/connector.h" | 14 #include "services/service_manager/public/cpp/connector.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 // TODO(xhwang): Hook up MediaLog when possible. | 18 // TODO(xhwang): Hook up MediaLog when possible. |
| 19 MediaService::MediaService(std::unique_ptr<MojoMediaClient> mojo_media_client) | 19 MediaService::MediaService(std::unique_ptr<MojoMediaClient> mojo_media_client) |
| 20 : mojo_media_client_(std::move(mojo_media_client)), | 20 : mojo_media_client_(std::move(mojo_media_client)) { |
| 21 media_log_(new MediaLog()) { | |
| 22 DCHECK(mojo_media_client_); | 21 DCHECK(mojo_media_client_); |
| 23 registry_.AddInterface<mojom::MediaService>(this); | 22 registry_.AddInterface<mojom::MediaService>(this); |
| 24 } | 23 } |
| 25 | 24 |
| 26 MediaService::~MediaService() {} | 25 MediaService::~MediaService() {} |
| 27 | 26 |
| 28 void MediaService::OnStart() { | 27 void MediaService::OnStart() { |
| 29 ref_factory_.reset(new service_manager::ServiceContextRefFactory( | 28 ref_factory_.reset(new service_manager::ServiceContextRefFactory( |
| 30 base::Bind(&service_manager::ServiceContext::RequestQuit, | 29 base::Bind(&service_manager::ServiceContext::RequestQuit, |
| 31 base::Unretained(context())))); | 30 base::Unretained(context())))); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 52 | 51 |
| 53 void MediaService::CreateInterfaceFactory( | 52 void MediaService::CreateInterfaceFactory( |
| 54 mojom::InterfaceFactoryRequest request, | 53 mojom::InterfaceFactoryRequest request, |
| 55 service_manager::mojom::InterfaceProviderPtr host_interfaces) { | 54 service_manager::mojom::InterfaceProviderPtr host_interfaces) { |
| 56 // Ignore request if service has already stopped. | 55 // Ignore request if service has already stopped. |
| 57 if (!mojo_media_client_) | 56 if (!mojo_media_client_) |
| 58 return; | 57 return; |
| 59 | 58 |
| 60 mojo::MakeStrongBinding( | 59 mojo::MakeStrongBinding( |
| 61 base::MakeUnique<InterfaceFactoryImpl>( | 60 base::MakeUnique<InterfaceFactoryImpl>( |
| 62 std::move(host_interfaces), media_log_, ref_factory_->CreateRef(), | 61 std::move(host_interfaces), &media_log_, ref_factory_->CreateRef(), |
| 63 mojo_media_client_.get()), | 62 mojo_media_client_.get()), |
| 64 std::move(request)); | 63 std::move(request)); |
| 65 } | 64 } |
| 66 | 65 |
| 67 } // namespace media | 66 } // namespace media |
| OLD | NEW |