Chromium Code Reviews| 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" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 | 34 |
| 35 void MediaService::OnBindInterface( | 35 void MediaService::OnBindInterface( |
| 36 const service_manager::BindSourceInfo& source_info, | 36 const service_manager::BindSourceInfo& source_info, |
| 37 const std::string& interface_name, | 37 const std::string& interface_name, |
| 38 mojo::ScopedMessagePipeHandle interface_pipe) { | 38 mojo::ScopedMessagePipeHandle interface_pipe) { |
| 39 registry_.BindInterface(source_info, interface_name, | 39 registry_.BindInterface(source_info, interface_name, |
| 40 std::move(interface_pipe)); | 40 std::move(interface_pipe)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool MediaService::OnServiceManagerConnectionLost() { | 43 bool MediaService::OnServiceManagerConnectionLost() { |
| 44 interface_factory_bindings_.CloseAllBindings(); | |
|
alokp
2017/05/16 16:54:44
Do we need to manually delete InterfaceFactory bin
xhwang
2017/05/16 17:05:33
That should work, but we need a comment to make su
| |
| 44 mojo_media_client_.reset(); | 45 mojo_media_client_.reset(); |
| 45 return true; | 46 return true; |
| 46 } | 47 } |
| 47 | 48 |
| 48 void MediaService::Create(const service_manager::BindSourceInfo& source_info, | 49 void MediaService::Create(const service_manager::BindSourceInfo& source_info, |
| 49 mojom::MediaServiceRequest request) { | 50 mojom::MediaServiceRequest request) { |
| 50 bindings_.AddBinding(this, std::move(request)); | 51 bindings_.AddBinding(this, std::move(request)); |
| 51 } | 52 } |
| 52 | 53 |
| 53 void MediaService::CreateInterfaceFactory( | 54 void MediaService::CreateInterfaceFactory( |
| 54 mojom::InterfaceFactoryRequest request, | 55 mojom::InterfaceFactoryRequest request, |
| 55 service_manager::mojom::InterfaceProviderPtr host_interfaces) { | 56 service_manager::mojom::InterfaceProviderPtr host_interfaces) { |
| 56 // Ignore request if service has already stopped. | 57 // Ignore request if service has already stopped. |
| 57 if (!mojo_media_client_) | 58 if (!mojo_media_client_) |
| 58 return; | 59 return; |
| 59 | 60 |
| 60 mojo::MakeStrongBinding( | 61 interface_factory_bindings_.AddBinding( |
| 61 base::MakeUnique<InterfaceFactoryImpl>( | 62 base::MakeUnique<InterfaceFactoryImpl>( |
| 62 std::move(host_interfaces), &media_log_, ref_factory_->CreateRef(), | 63 std::move(host_interfaces), &media_log_, ref_factory_->CreateRef(), |
| 63 mojo_media_client_.get()), | 64 mojo_media_client_.get()), |
| 64 std::move(request)); | 65 std::move(request)); |
| 65 } | 66 } |
| 66 | 67 |
| 67 } // namespace media | 68 } // namespace media |
| OLD | NEW |