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 "components/leveldb/public/interfaces/leveldb.mojom.h" | 8 #include "components/leveldb/public/interfaces/leveldb.mojom.h" |
9 #include "mojo/public/cpp/bindings/binding_set.h" | 9 #include "mojo/public/cpp/bindings/binding_set.h" |
10 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 10 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
11 #include "mojo/shell/public/cpp/interface_factory.h" | 11 #include "mojo/shell/public/cpp/interface_factory.h" |
| 12 #include "mojo/shell/public/cpp/message_loop_ref.h" |
12 #include "mojo/shell/public/cpp/shell_client.h" | 13 #include "mojo/shell/public/cpp/shell_client.h" |
13 | 14 |
14 namespace leveldb { | 15 namespace leveldb { |
15 | 16 |
| 17 scoped_ptr<mojo::ShellClient> CreateLevelDBApp(); |
| 18 |
16 class LevelDBApp : public mojo::ShellClient, | 19 class LevelDBApp : public mojo::ShellClient, |
17 public mojo::InterfaceFactory<LevelDBService> { | 20 public mojo::InterfaceFactory<LevelDBService> { |
18 public: | 21 public: |
19 LevelDBApp(); | 22 LevelDBApp(); |
20 ~LevelDBApp() override; | 23 ~LevelDBApp() override; |
21 | 24 |
22 private: | 25 private: |
23 // |ShellClient| override: | 26 // |ShellClient| override: |
24 void Initialize(mojo::Connector* connector, | 27 void Initialize(mojo::Connector* connector, |
25 const std::string& url, | 28 const std::string& url, |
26 uint32_t id, | 29 uint32_t id, |
27 uint32_t user_id) override; | 30 uint32_t user_id) override; |
28 bool AcceptConnection(mojo::Connection* connection) override; | 31 bool AcceptConnection(mojo::Connection* connection) override; |
29 | 32 |
30 // TODO(erg): What do we have to do on shell error? | |
31 // bool OnShellConnectionError() override; | |
32 | |
33 // |InterfaceFactory<LevelDBService>| implementation: | 33 // |InterfaceFactory<LevelDBService>| implementation: |
34 void Create(mojo::Connection* connection, | 34 void Create(mojo::Connection* connection, |
35 mojo::InterfaceRequest<LevelDBService> request) override; | 35 mojo::InterfaceRequest<LevelDBService> request) override; |
36 | 36 |
37 mojo::TracingImpl tracing_; | 37 mojo::TracingImpl tracing_; |
38 scoped_ptr<LevelDBService> service_; | 38 scoped_ptr<LevelDBService> service_; |
39 mojo::BindingSet<LevelDBService> bindings_; | 39 mojo::BindingSet<LevelDBService> bindings_; |
| 40 mojo::MessageLoopRefFactory ref_factory_; |
40 | 41 |
41 DISALLOW_COPY_AND_ASSIGN(LevelDBApp); | 42 DISALLOW_COPY_AND_ASSIGN(LevelDBApp); |
42 }; | 43 }; |
43 | 44 |
44 } // namespace leveldb | 45 } // namespace leveldb |
45 | 46 |
46 #endif // COMPONENTS_LEVELDB_LEVELDB_APP_H_ | 47 #endif // COMPONENTS_LEVELDB_LEVELDB_APP_H_ |
OLD | NEW |