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

Unified Diff: services/video_capture/service_manager_service_impl.h

Issue 2824883005: [Mojo Video Capture] Stop service when last client disconnects. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: services/video_capture/service_manager_service_impl.h
diff --git a/services/video_capture/service_manager_service_impl.h b/services/video_capture/service_manager_service_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..24cbbb1d9033b27bb952f39e78e2aee8fed6ee9c
--- /dev/null
+++ b/services/video_capture/service_manager_service_impl.h
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
mcasas 2017/04/26 22:12:31 s/2016/2017/
chfremer 2017/04/26 23:33:36 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_VIDEO_CAPTURE_SERVICE_MANAGER_SERVICE_IMPL_H_
+#define SERVICES_VIDEO_CAPTURE_SERVICE_MANAGER_SERVICE_IMPL_H_
+
+#include <memory>
+
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "services/service_manager/public/cpp/binder_registry.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context_ref.h"
+#include "services/video_capture/public/interfaces/service.mojom.h"
+
+namespace video_capture {
+
+class ServiceManagerServiceImpl : public service_manager::Service {
Ken Rockot(use gerrit already) 2017/04/26 19:40:19 nit: Hmm, is this rename really necessary?
chfremer 2017/04/26 20:01:54 Hmm, not absolutely necessary, but I feel it is us
mcasas 2017/04/26 22:12:31 namespace disambiguates, right? video_capture::Ser
chfremer 2017/04/26 23:33:36 Yes, to me too, but unfortunately both classes liv
+ public:
+ ServiceManagerServiceImpl();
+ ~ServiceManagerServiceImpl() override;
+
+ // service_manager::Service:
mcasas 2017/04/26 22:12:31 // service_manager::Service implementation.
chfremer 2017/04/26 23:33:36 Done.
+ void OnStart() override;
+ void OnBindInterface(const service_manager::ServiceInfo& source_info,
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle interface_pipe) override;
+ bool OnServiceManagerConnectionLost() override;
+
+ private:
+ void OnVideoCaptureServiceRequest(mojom::ServiceRequest request);
+ void SetShutdownDelayInSeconds(float seconds);
+ void MaybeRequestQuitDelayed();
+ void MaybeRequestQuit();
+
+ float shutdown_delay_in_seconds_;
+ service_manager::BinderRegistry registry_;
+ std::unique_ptr<service_manager::ServiceContextRefFactory> ref_factory_;
+ base::WeakPtrFactory<ServiceManagerServiceImpl> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ServiceManagerServiceImpl);
+};
+
+} // namespace video_capture
+
+#endif // SERVICES_VIDEO_CAPTURE_SERVICE_MANAGER_SERVICE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698