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

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

Issue 2824883005: [Mojo Video Capture] Stop service when last client disconnects. (Closed)
Patch Set: Incorporate suggestions from PatchSet 1 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_VIDEO_CAPTURE_DEVICE_FACTORY_PROVIDER_H_
6 #define SERVICES_VIDEO_CAPTURE_DEVICE_FACTORY_PROVIDER_H_
7
8 #include <memory>
9
10 #include "mojo/public/cpp/bindings/binding_set.h"
11 #include "services/service_manager/public/cpp/interface_factory.h"
12 #include "services/service_manager/public/cpp/service.h"
13 #include "services/service_manager/public/cpp/service_context_ref.h"
14 #include "services/video_capture/public/interfaces/device_factory_provider.mojom .h"
15
16 namespace video_capture {
17
18 class DeviceFactoryMediaToMojoAdapter;
19
20 class DeviceFactoryProviderImpl : public mojom::DeviceFactoryProvider {
21 public:
22 DeviceFactoryProviderImpl(
23 std::unique_ptr<service_manager::ServiceContextRef> service_ref,
24 base::Callback<void(float)> set_shutdown_delay_cb);
25 ~DeviceFactoryProviderImpl() override;
26
27 // mojom::DeviceFactoryProvider implementation.
28 void ConnectToDeviceFactory(mojom::DeviceFactoryRequest request) override;
29 void ConnectToFakeDeviceFactory(mojom::DeviceFactoryRequest request) override;
30 void SetShutdownDelayInSeconds(float seconds) override;
31
32 private:
33 void LazyInitializeDeviceFactory();
34 void LazyInitializeFakeDeviceFactory();
35
36 mojo::BindingSet<mojom::DeviceFactory> factory_bindings_;
37 mojo::BindingSet<mojom::DeviceFactory> fake_factory_bindings_;
38 std::unique_ptr<DeviceFactoryMediaToMojoAdapter> device_factory_;
39 std::unique_ptr<DeviceFactoryMediaToMojoAdapter> fake_device_factory_;
40
41 const std::unique_ptr<service_manager::ServiceContextRef> service_ref_;
42 base::Callback<void(float)> set_shutdown_delay_cb_;
43
44 DISALLOW_COPY_AND_ASSIGN(DeviceFactoryProviderImpl);
45 };
46
47 } // namespace video_capture
48
49 #endif // SERVICES_VIDEO_CAPTURE_DEVICE_FACTORY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698