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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: services/video_capture/video_capture_device_factory_impl.h
diff --git a/services/video_capture/video_capture_device_factory_impl.h b/services/video_capture/video_capture_device_factory_impl.h
index 9775a57f92886087b2e2763e10d417fc0f45cb0c..9f03a203e7decf0895012f7829e138989fba735f 100644
--- a/services/video_capture/video_capture_device_factory_impl.h
+++ b/services/video_capture/video_capture_device_factory_impl.h
@@ -5,13 +5,20 @@
#ifndef SERVICES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_IMPL_H_
#define SERVICES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_IMPL_H_
+#include <vector>
+
#include "services/video_capture/public/interfaces/video_capture_device_factory.mojom.h"
+#include "services/video_capture/video_capture_device_impl.h"
namespace video_capture {
-// Implementation of the VideoCaptureDeviceFactory Mojo interface.
class VideoCaptureDeviceFactoryImpl : public mojom::VideoCaptureDeviceFactory {
public:
+ VideoCaptureDeviceFactoryImpl();
+ ~VideoCaptureDeviceFactoryImpl() override;
+
+ mojom::VideoCaptureDeviceDescriptorPtr AddFakeVideoCaptureDevice();
+
// mojom::VideoCaptureDeviceFactory:
void EnumerateDeviceDescriptors(
const EnumerateDeviceDescriptorsCallback& callback) override;
@@ -19,7 +26,32 @@ class VideoCaptureDeviceFactoryImpl : public mojom::VideoCaptureDeviceFactory {
mojom::VideoCaptureDeviceDescriptorPtr device_descriptor,
const GetSupportedFormatsCallback& callback) override;
void CreateDevice(mojom::VideoCaptureDeviceDescriptorPtr device_descriptor,
- mojom::VideoCaptureDeviceRequest device_request) override;
+ mojom::VideoCaptureDeviceRequest device_request,
+ const CreateDeviceCallback& callback) override;
+
+ private:
+ // We use a std::vector of structs with the |descriptor| field as a unique
+ // keys. We do it this way instead of using a std::map because Mojo-generated
+ // structs (here VideoCaptureDeviceDescriptor) do not support usage as keys
+ // 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
+ // be minimal assuming that the number of capture devices is typically small.
+ class DeviceEntry {
+ public:
+ DeviceEntry(mojom::VideoCaptureDeviceDescriptorPtr descriptor,
+ std::unique_ptr<VideoCaptureDeviceImpl> bindable_target);
+ ~DeviceEntry();
+ DeviceEntry(DeviceEntry&& other);
+ DeviceEntry& operator=(DeviceEntry&& other);
+
+ mojom::VideoCaptureDeviceDescriptorPtr MakeDescriptorCopy() const;
+
+ private:
+ mojom::VideoCaptureDeviceDescriptorPtr descriptor_;
+ std::unique_ptr<VideoCaptureDeviceImpl> device_;
+ };
+
+ std::vector<DeviceEntry> devices_;
+ int fake_device_count_;
};
} // namespace video_capture

Powered by Google App Engine
This is Rietveld 408576698