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

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: Split out rename to separate CL 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
8 #include "services/video_capture/public/interfaces/video_capture_device_factory. mojom.h" 10 #include "services/video_capture/public/interfaces/video_capture_device_factory. mojom.h"
11 #include "services/video_capture/video_capture_device_impl.h"
9 12
10 namespace video_capture { 13 namespace video_capture {
11 14
12 // Implementation of the VideoCaptureDeviceFactory Mojo interface.
13 class VideoCaptureDeviceFactoryImpl : public mojom::VideoCaptureDeviceFactory { 15 class VideoCaptureDeviceFactoryImpl : public mojom::VideoCaptureDeviceFactory {
14 public: 16 public:
17 VideoCaptureDeviceFactoryImpl();
18 ~VideoCaptureDeviceFactoryImpl() override;
19
20 mojom::VideoCaptureDeviceDescriptorPtr AddFakeVideoCaptureDevice();
21
15 // mojom::VideoCaptureDeviceFactory: 22 // mojom::VideoCaptureDeviceFactory:
16 void EnumerateDeviceDescriptors( 23 void EnumerateDeviceDescriptors(
17 const EnumerateDeviceDescriptorsCallback& callback) override; 24 const EnumerateDeviceDescriptorsCallback& callback) override;
18 void GetSupportedFormats( 25 void GetSupportedFormats(
19 mojom::VideoCaptureDeviceDescriptorPtr device_descriptor, 26 mojom::VideoCaptureDeviceDescriptorPtr device_descriptor,
20 const GetSupportedFormatsCallback& callback) override; 27 const GetSupportedFormatsCallback& callback) override;
21 void CreateDevice(mojom::VideoCaptureDeviceDescriptorPtr device_descriptor, 28 void CreateDevice(mojom::VideoCaptureDeviceDescriptorPtr device_descriptor,
22 mojom::VideoCaptureDeviceRequest device_request) override; 29 mojom::VideoCaptureDeviceRequest device_request,
30 const CreateDeviceCallback& callback) override;
31
32 private:
33 // We use a std::vector of structs with the |descriptor| field as a unique
34 // keys. We do it this way instead of using a std::map because Mojo-generated
35 // structs (here VideoCaptureDeviceDescriptor) do not support usage as keys
36 // inside std::map. The performance penalty of not using a map should
yzshen1 2016/08/16 17:55:08 If you want, you could easily define a comparison
chfremer 2016/08/16 18:34:40 Good point. Let me rephrase the comment to clarify
37 // be minimal assuming that the number of capture devices is typically small.
38 class DeviceEntry {
39 public:
40 DeviceEntry(mojom::VideoCaptureDeviceDescriptorPtr descriptor,
41 std::unique_ptr<VideoCaptureDeviceImpl> bindable_target);
42 ~DeviceEntry();
43 DeviceEntry(DeviceEntry&& other);
44 DeviceEntry& operator=(DeviceEntry&& other);
45
46 mojom::VideoCaptureDeviceDescriptorPtr MakeDescriptorCopy() const;
47
48 private:
49 mojom::VideoCaptureDeviceDescriptorPtr descriptor_;
50 std::unique_ptr<VideoCaptureDeviceImpl> device_;
51 };
52
53 std::vector<DeviceEntry> devices_;
54 int fake_device_count_;
23 }; 55 };
24 56
25 } // namespace video_capture 57 } // namespace video_capture
26 58
27 #endif // SERVICES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_IMPL_H_ 59 #endif // SERVICES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698