Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: services/video_capture/service_impl.cc

Issue 2795883002: Eliminate OnConnect usage (Closed)
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/video_capture/service_impl.h ('k') | ui/ozone/platform/drm/ozone_platform_gbm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "media/capture/video/fake_video_capture_device_factory.h" 9 #include "media/capture/video/fake_video_capture_device_factory.h"
10 #include "media/capture/video/video_capture_buffer_pool.h" 10 #include "media/capture/video/video_capture_buffer_pool.h"
11 #include "media/capture/video/video_capture_buffer_tracker.h" 11 #include "media/capture/video/video_capture_buffer_tracker.h"
12 #include "media/capture/video/video_capture_jpeg_decoder.h" 12 #include "media/capture/video/video_capture_jpeg_decoder.h"
13 #include "services/service_manager/public/cpp/interface_registry.h" 13 #include "services/service_manager/public/cpp/service_info.h"
14 #include "services/video_capture/device_factory_media_to_mojo_adapter.h" 14 #include "services/video_capture/device_factory_media_to_mojo_adapter.h"
15 15
16 namespace { 16 namespace {
17 17
18 // TODO(chfremer): Replace with an actual decoder factory. 18 // TODO(chfremer): Replace with an actual decoder factory.
19 // https://crbug.com/584797 19 // https://crbug.com/584797
20 std::unique_ptr<media::VideoCaptureJpegDecoder> CreateJpegDecoder() { 20 std::unique_ptr<media::VideoCaptureJpegDecoder> CreateJpegDecoder() {
21 return nullptr; 21 return nullptr;
22 } 22 }
23 23
24 } // anonymous namespace 24 } // anonymous namespace
25 25
26 namespace video_capture { 26 namespace video_capture {
27 27
28 ServiceImpl::ServiceImpl() = default; 28 ServiceImpl::ServiceImpl() {
29 registry_.AddInterface<mojom::Service>(this);
30 }
29 31
30 ServiceImpl::~ServiceImpl() = default; 32 ServiceImpl::~ServiceImpl() = default;
31 33
32 bool ServiceImpl::OnConnect(const service_manager::ServiceInfo& remote_info, 34 void ServiceImpl::OnBindInterface(
33 service_manager::InterfaceRegistry* registry) { 35 const service_manager::ServiceInfo& source_info,
34 registry->AddInterface<mojom::Service>(this); 36 const std::string& interface_name,
35 return true; 37 mojo::ScopedMessagePipeHandle interface_pipe) {
38 registry_.BindInterface(source_info.identity, interface_name,
39 std::move(interface_pipe));
36 } 40 }
37 41
38 void ServiceImpl::Create(const service_manager::Identity& remote_identity, 42 void ServiceImpl::Create(const service_manager::Identity& remote_identity,
39 mojom::ServiceRequest request) { 43 mojom::ServiceRequest request) {
40 service_bindings_.AddBinding(this, std::move(request)); 44 service_bindings_.AddBinding(this, std::move(request));
41 } 45 }
42 46
43 void ServiceImpl::ConnectToDeviceFactory(mojom::DeviceFactoryRequest request) { 47 void ServiceImpl::ConnectToDeviceFactory(mojom::DeviceFactoryRequest request) {
44 LazyInitializeDeviceFactory(); 48 LazyInitializeDeviceFactory();
45 factory_bindings_.AddBinding(device_factory_.get(), std::move(request)); 49 factory_bindings_.AddBinding(device_factory_.get(), std::move(request));
(...skipping 23 matching lines...) Expand all
69 void ServiceImpl::LazyInitializeFakeDeviceFactory() { 73 void ServiceImpl::LazyInitializeFakeDeviceFactory() {
70 if (fake_device_factory_) 74 if (fake_device_factory_)
71 return; 75 return;
72 76
73 fake_device_factory_ = base::MakeUnique<DeviceFactoryMediaToMojoAdapter>( 77 fake_device_factory_ = base::MakeUnique<DeviceFactoryMediaToMojoAdapter>(
74 base::MakeUnique<media::FakeVideoCaptureDeviceFactory>(), 78 base::MakeUnique<media::FakeVideoCaptureDeviceFactory>(),
75 base::Bind(&CreateJpegDecoder)); 79 base::Bind(&CreateJpegDecoder));
76 } 80 }
77 81
78 } // namespace video_capture 82 } // namespace video_capture
OLDNEW
« no previous file with comments | « services/video_capture/service_impl.h ('k') | ui/ozone/platform/drm/ozone_platform_gbm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698