 Chromium Code Reviews
 Chromium Code Reviews Issue 2824883005:
  [Mojo Video Capture] Stop service when last client disconnects.  (Closed)
    
  
    Issue 2824883005:
  [Mojo Video Capture] Stop service when last client disconnects.  (Closed) 
  | Index: services/video_capture/device_factory_media_to_mojo_adapter.h | 
| diff --git a/services/video_capture/device_factory_media_to_mojo_adapter.h b/services/video_capture/device_factory_media_to_mojo_adapter.h | 
| index 6c10ff70dfd4359be006234ae1f5406d1b39a182..efeb1ddc59a8e384b73afc4679aa5dd5e7029258 100644 | 
| --- a/services/video_capture/device_factory_media_to_mojo_adapter.h | 
| +++ b/services/video_capture/device_factory_media_to_mojo_adapter.h | 
| @@ -10,6 +10,7 @@ | 
| #include "media/capture/video/video_capture_device_client.h" | 
| #include "media/capture/video/video_capture_system.h" | 
| #include "mojo/public/cpp/bindings/binding.h" | 
| +#include "services/service_manager/public/cpp/service_context_ref.h" | 
| #include "services/video_capture/public/interfaces/device_factory.mojom.h" | 
| namespace video_capture { | 
| @@ -23,6 +24,7 @@ class DeviceMediaToMojoAdapter; | 
| class DeviceFactoryMediaToMojoAdapter : public mojom::DeviceFactory { | 
| public: | 
| DeviceFactoryMediaToMojoAdapter( | 
| + std::unique_ptr<service_manager::ServiceContextRef> service_ref, | 
| std::unique_ptr<media::VideoCaptureSystem> capture_system, | 
| const media::VideoCaptureJpegDecoderFactoryCB& | 
| jpeg_decoder_factory_callback); | 
| @@ -48,11 +50,23 @@ class DeviceFactoryMediaToMojoAdapter : public mojom::DeviceFactory { | 
| std::unique_ptr<mojo::Binding<mojom::Device>> binding; | 
| }; | 
| + void DiscardDeviceInfosAndCallContinuation( | 
| + base::Closure continuation, | 
| + const std::vector<media::VideoCaptureDeviceInfo>&); | 
| + void CreateAndAddNewDevice(const std::string& device_id, | 
| + mojom::DeviceRequest device_request, | 
| + const CreateDeviceCallback& callback); | 
| void OnClientConnectionErrorOrClose(const std::string& device_id); | 
| + const std::unique_ptr<service_manager::ServiceContextRef> service_ref_; | 
| const std::unique_ptr<media::VideoCaptureSystem> capture_system_; | 
| const media::VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; | 
| std::map<std::string, ActiveDeviceEntry> active_devices_by_id_; | 
| + bool has_called_get_device_infos_ = false; | 
| 
mcasas
2017/04/26 22:12:31
nit: initialize this to false in the ctor initiali
 
chfremer
2017/04/26 23:33:35
Done.
 | 
| + | 
| + base::WeakPtrFactory<DeviceFactoryMediaToMojoAdapter> weak_factory_; | 
| + | 
| + DISALLOW_COPY_AND_ASSIGN(DeviceFactoryMediaToMojoAdapter); | 
| }; | 
| } // namespace video_capture |