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

Unified Diff: services/flog/flog_service_impl.h

Issue 2046703002: Add 'flog' service implementation. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 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/flog/flog_service_impl.h
diff --git a/services/flog/flog_service_impl.h b/services/flog/flog_service_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..978ded543bc924896f08fedac3bc008831adce2d
--- /dev/null
+++ b/services/flog/flog_service_impl.h
@@ -0,0 +1,52 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_SERVICES_FLOG_FLOG_SERVICE_IMPL_H_
+#define MOJO_SERVICES_FLOG_FLOG_SERVICE_IMPL_H_
+
+#include <map>
+#include <memory>
+
+#include "mojo/common/binding_set.h"
+#include "mojo/services/flog/interfaces/flog.mojom.h"
+#include "services/flog/flog_directory.h"
+#include "services/util/cpp/factory_service_base.h"
+#include "services/util/cpp/incident.h"
+
+namespace mojo {
+namespace flog {
+
+// FlogService implementation.
+class FlogServiceImpl : public util::FactoryServiceBase, public FlogService {
+ public:
+ FlogServiceImpl();
+
+ ~FlogServiceImpl() override;
+
+ // ApplicationImplBase overrides.
+ void OnInitialize() override;
+
+ bool OnAcceptConnection(ServiceProviderImpl* service_provider_impl) override;
+
+ // FlogService implementation.
+ void CreateLogger(InterfaceRequest<FlogLogger> logger,
+ const String& label) override;
+
+ void GetLogDescriptions(const GetLogDescriptionsCallback& callback) override;
+
+ void CreateReader(InterfaceRequest<FlogReader> reader,
+ uint32_t log_id) override;
+
+ private:
+ Incident ready_;
+ BindingSet<FlogService> bindings_;
+ uint32_t last_allocated_log_id_ = 0;
+ std::map<uint32_t, std::string> log_labels_by_id_;
+ std::shared_ptr<FlogDirectory> directory_;
+};
+
+} // namespace flog
+} // namespace mojo
+
+#endif // MOJO_SERVICES_FLOG_FLOG_SERVICE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698