| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_LEVELDB_LEVELDB_APP_H_ | 5 #ifndef COMPONENTS_LEVELDB_LEVELDB_APP_H_ |
| 6 #define COMPONENTS_LEVELDB_LEVELDB_APP_H_ | 6 #define COMPONENTS_LEVELDB_LEVELDB_APP_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| 11 #include "components/leveldb/public/interfaces/leveldb.mojom.h" | 11 #include "components/leveldb/public/interfaces/leveldb.mojom.h" |
| 12 #include "mojo/public/cpp/bindings/binding_set.h" | 12 #include "mojo/public/cpp/bindings/binding_set.h" |
| 13 #include "services/service_manager/public/cpp/binder_registry.h" | 13 #include "services/service_manager/public/cpp/binder_registry.h" |
| 14 #include "services/service_manager/public/cpp/interface_factory.h" | 14 #include "services/service_manager/public/cpp/interface_factory.h" |
| 15 #include "services/service_manager/public/cpp/service.h" | 15 #include "services/service_manager/public/cpp/service.h" |
| 16 #include "services/tracing/public/cpp/provider.h" | |
| 17 | 16 |
| 18 namespace leveldb { | 17 namespace leveldb { |
| 19 | 18 |
| 20 class LevelDBApp | 19 class LevelDBApp |
| 21 : public service_manager::Service, | 20 : public service_manager::Service, |
| 22 public service_manager::InterfaceFactory<mojom::LevelDBService> { | 21 public service_manager::InterfaceFactory<mojom::LevelDBService> { |
| 23 public: | 22 public: |
| 24 LevelDBApp(); | 23 LevelDBApp(); |
| 25 ~LevelDBApp() override; | 24 ~LevelDBApp() override; |
| 26 | 25 |
| 27 private: | 26 private: |
| 28 // |Service| override: | 27 // |Service| override: |
| 29 void OnStart() override; | 28 void OnStart() override; |
| 30 void OnBindInterface(const service_manager::ServiceInfo& source_info, | 29 void OnBindInterface(const service_manager::ServiceInfo& source_info, |
| 31 const std::string& interface_name, | 30 const std::string& interface_name, |
| 32 mojo::ScopedMessagePipeHandle interface_pipe) override; | 31 mojo::ScopedMessagePipeHandle interface_pipe) override; |
| 33 | 32 |
| 34 // |InterfaceFactory<mojom::LevelDBService>| implementation: | 33 // |InterfaceFactory<mojom::LevelDBService>| implementation: |
| 35 void Create(const service_manager::Identity& remote_identity, | 34 void Create(const service_manager::Identity& remote_identity, |
| 36 leveldb::mojom::LevelDBServiceRequest request) override; | 35 leveldb::mojom::LevelDBServiceRequest request) override; |
| 37 | 36 |
| 38 tracing::Provider tracing_; | |
| 39 std::unique_ptr<mojom::LevelDBService> service_; | 37 std::unique_ptr<mojom::LevelDBService> service_; |
| 40 service_manager::BinderRegistry registry_; | 38 service_manager::BinderRegistry registry_; |
| 41 mojo::BindingSet<mojom::LevelDBService> bindings_; | 39 mojo::BindingSet<mojom::LevelDBService> bindings_; |
| 42 | 40 |
| 43 base::Thread file_thread_; | 41 base::Thread file_thread_; |
| 44 | 42 |
| 45 DISALLOW_COPY_AND_ASSIGN(LevelDBApp); | 43 DISALLOW_COPY_AND_ASSIGN(LevelDBApp); |
| 46 }; | 44 }; |
| 47 | 45 |
| 48 } // namespace leveldb | 46 } // namespace leveldb |
| 49 | 47 |
| 50 #endif // COMPONENTS_LEVELDB_LEVELDB_APP_H_ | 48 #endif // COMPONENTS_LEVELDB_LEVELDB_APP_H_ |
| OLD | NEW |