| 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 "media/base/media_log.h" | 9 #include "media/base/media_log.h" |
| 10 #include "media/mojo/services/interface_factory_impl.h" |
| 10 #include "media/mojo/services/mojo_media_client.h" | 11 #include "media/mojo/services/mojo_media_client.h" |
| 11 #include "media/mojo/services/service_factory_impl.h" | |
| 12 #include "mojo/public/cpp/bindings/strong_binding.h" | 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 13 #include "services/service_manager/public/cpp/connection.h" | 13 #include "services/service_manager/public/cpp/connection.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 const base::Closure& quit_closure) | 20 const base::Closure& quit_closure) |
| 21 : mojo_media_client_(std::move(mojo_media_client)), | 21 : mojo_media_client_(std::move(mojo_media_client)), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 39 bool MediaService::OnStop() { | 39 bool MediaService::OnStop() { |
| 40 mojo_media_client_.reset(); | 40 mojo_media_client_.reset(); |
| 41 return true; | 41 return true; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void MediaService::Create(const service_manager::Identity& remote_identity, | 44 void MediaService::Create(const service_manager::Identity& remote_identity, |
| 45 mojom::MediaServiceRequest request) { | 45 mojom::MediaServiceRequest request) { |
| 46 bindings_.AddBinding(this, std::move(request)); | 46 bindings_.AddBinding(this, std::move(request)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void MediaService::CreateServiceFactory( | 49 void MediaService::CreateInterfaceFactory( |
| 50 mojom::ServiceFactoryRequest request, | 50 mojom::InterfaceFactoryRequest request, |
| 51 service_manager::mojom::InterfaceProviderPtr remote_interfaces) { | 51 service_manager::mojom::InterfaceProviderPtr remote_interfaces) { |
| 52 // Ignore request if service has already stopped. | 52 // Ignore request if service has already stopped. |
| 53 if (!mojo_media_client_) | 53 if (!mojo_media_client_) |
| 54 return; | 54 return; |
| 55 | 55 |
| 56 mojo::MakeStrongBinding( | 56 mojo::MakeStrongBinding( |
| 57 base::MakeUnique<ServiceFactoryImpl>(std::move(remote_interfaces), | 57 base::MakeUnique<InterfaceFactoryImpl>( |
| 58 media_log_, ref_factory_.CreateRef(), | 58 std::move(remote_interfaces), media_log_, ref_factory_.CreateRef(), |
| 59 mojo_media_client_.get()), | 59 mojo_media_client_.get()), |
| 60 std::move(request)); | 60 std::move(request)); |
| 61 } | 61 } |
| 62 | 62 |
| 63 } // namespace media | 63 } // namespace media |
| OLD | NEW |