OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/video_capture/service_impl.h" | 5 #include "services/video_capture/service_impl.h" |
6 | 6 |
7 #include "mojo/public/cpp/bindings/strong_binding.h" | 7 #include "mojo/public/cpp/bindings/strong_binding.h" |
8 #include "services/service_manager/public/cpp/service_context.h" | 8 #include "services/service_manager/public/cpp/service_context.h" |
9 #include "services/video_capture/device_factory_provider_impl.h" | 9 #include "services/video_capture/device_factory_provider_impl.h" |
10 #include "services/video_capture/public/interfaces/constants.mojom.h" | 10 #include "services/video_capture/public/interfaces/constants.mojom.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 ref_factory_ = | 24 ref_factory_ = |
25 base::MakeUnique<service_manager::ServiceContextRefFactory>(base::Bind( | 25 base::MakeUnique<service_manager::ServiceContextRefFactory>(base::Bind( |
26 &ServiceImpl::MaybeRequestQuitDelayed, base::Unretained(this))); | 26 &ServiceImpl::MaybeRequestQuitDelayed, base::Unretained(this))); |
27 registry_.AddInterface<mojom::DeviceFactoryProvider>( | 27 registry_.AddInterface<mojom::DeviceFactoryProvider>( |
28 // Unretained |this| is safe because |registry_| is owned by |this|. | 28 // Unretained |this| is safe because |registry_| is owned by |this|. |
29 base::Bind(&ServiceImpl::OnDeviceFactoryProviderRequest, | 29 base::Bind(&ServiceImpl::OnDeviceFactoryProviderRequest, |
30 base::Unretained(this))); | 30 base::Unretained(this))); |
31 } | 31 } |
32 | 32 |
33 void ServiceImpl::OnBindInterface( | 33 void ServiceImpl::OnBindInterface( |
34 const service_manager::ServiceInfo& source_info, | 34 const service_manager::BindSourceInfo& source_info, |
35 const std::string& interface_name, | 35 const std::string& interface_name, |
36 mojo::ScopedMessagePipeHandle interface_pipe) { | 36 mojo::ScopedMessagePipeHandle interface_pipe) { |
37 DCHECK(thread_checker_.CalledOnValidThread()); | 37 DCHECK(thread_checker_.CalledOnValidThread()); |
38 registry_.BindInterface(source_info.identity, interface_name, | 38 registry_.BindInterface(source_info.identity, interface_name, |
39 std::move(interface_pipe)); | 39 std::move(interface_pipe)); |
40 } | 40 } |
41 | 41 |
42 bool ServiceImpl::OnServiceManagerConnectionLost() { | 42 bool ServiceImpl::OnServiceManagerConnectionLost() { |
43 DCHECK(thread_checker_.CalledOnValidThread()); | 43 DCHECK(thread_checker_.CalledOnValidThread()); |
44 return true; | 44 return true; |
(...skipping 28 matching lines...) Expand all Loading... |
73 | 73 |
74 void ServiceImpl::MaybeRequestQuit() { | 74 void ServiceImpl::MaybeRequestQuit() { |
75 DCHECK(thread_checker_.CalledOnValidThread()); | 75 DCHECK(thread_checker_.CalledOnValidThread()); |
76 DCHECK(ref_factory_); | 76 DCHECK(ref_factory_); |
77 if (ref_factory_->HasNoRefs()) { | 77 if (ref_factory_->HasNoRefs()) { |
78 context()->RequestQuit(); | 78 context()->RequestQuit(); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 } // namespace video_capture | 82 } // namespace video_capture |
OLD | NEW |