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

Side by Side Diff: services/video_capture/video_capture_device_factory_impl.h

Issue 2244763002: Video Capture Mojo (1.4a.a): Add service configurator interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@MakeService
Patch Set: mcasas' comments Created 4 years, 4 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
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 #ifndef SERVICES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_IMPL_H_ 5 #ifndef SERVICES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_IMPL_H_
6 #define SERVICES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_IMPL_H_ 6 #define SERVICES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_IMPL_H_
7 7
8 #include <vector>
9
10 #include "mojo/public/cpp/bindings/binding_set.h"
8 #include "services/video_capture/public/interfaces/video_capture_device_factory. mojom.h" 11 #include "services/video_capture/public/interfaces/video_capture_device_factory. mojom.h"
12 #include "services/video_capture/video_capture_device_proxy_impl.h"
9 13
10 namespace video_capture { 14 namespace video_capture {
11 15
12 // Implementation of the VideoCaptureDeviceFactory Mojo interface.
13 class VideoCaptureDeviceFactoryImpl : public mojom::VideoCaptureDeviceFactory { 16 class VideoCaptureDeviceFactoryImpl : public mojom::VideoCaptureDeviceFactory {
14 public: 17 public:
18 VideoCaptureDeviceFactoryImpl();
19 ~VideoCaptureDeviceFactoryImpl() override;
20
21 mojom::VideoCaptureDeviceDescriptorPtr AddFakeVideoCaptureDevice();
22
15 // mojom::VideoCaptureDeviceFactory: 23 // mojom::VideoCaptureDeviceFactory:
16 void EnumerateDeviceDescriptors( 24 void EnumerateDeviceDescriptors(
17 const EnumerateDeviceDescriptorsCallback& callback) override; 25 const EnumerateDeviceDescriptorsCallback& callback) override;
18 void GetSupportedFormats( 26 void GetSupportedFormats(
19 mojom::VideoCaptureDeviceDescriptorPtr device_descriptor, 27 mojom::VideoCaptureDeviceDescriptorPtr device_descriptor,
20 const GetSupportedFormatsCallback& callback) override; 28 const GetSupportedFormatsCallback& callback) override;
21 void CreateDevice(mojom::VideoCaptureDeviceDescriptorPtr device_descriptor, 29 void CreateDeviceProxy(
22 mojom::VideoCaptureDeviceRequest device_request) override; 30 mojom::VideoCaptureDeviceDescriptorPtr device_descriptor,
31 mojom::VideoCaptureDeviceProxyRequest proxy_request,
32 const CreateDeviceProxyCallback& callback) override;
33
34 private:
35 // We use a std::vector of structs with the |descriptor| field as a unique
36 // keys. We do it this way instead of using a std::map because Mojo-generated
37 // structs (here VideoCaptureDeviceDescriptor) do not support usage as keys
38 // inside std::map. The performance penalty of not using a map should
39 // be minimal assuming that the number of capture devices is typically small.
40 class DeviceEntry {
41 public:
42 DeviceEntry(mojom::VideoCaptureDeviceDescriptorPtr descriptor,
43 std::unique_ptr<VideoCaptureDeviceProxyImpl> bindable_target);
44 ~DeviceEntry();
45 DeviceEntry(DeviceEntry&& other);
46 DeviceEntry& operator=(DeviceEntry&& other);
47
48 mojom::VideoCaptureDeviceDescriptorPtr MakeDescriptorCopy() const;
49
50 private:
51 mojom::VideoCaptureDeviceDescriptorPtr descriptor_;
52 std::unique_ptr<VideoCaptureDeviceProxyImpl> device_proxy_;
53 };
54
55 std::vector<DeviceEntry> devices_;
56 int fake_device_count_;
23 }; 57 };
24 58
25 } // namespace video_capture 59 } // namespace video_capture
26 60
27 #endif // SERVICES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_IMPL_H_ 61 #endif // SERVICES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698