Chromium Code Reviews| 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_PROFILE_SERVICE_PROFILE_APP_H_ | 5 #ifndef COMPONENTS_PROFILE_SERVICE_PROFILE_APP_H_ |
| 6 #define COMPONENTS_PROFILE_SERVICE_PROFILE_APP_H_ | 6 #define COMPONENTS_PROFILE_SERVICE_PROFILE_APP_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | |
| 8 #include "components/filesystem/lock_table.h" | 9 #include "components/filesystem/lock_table.h" |
| 9 #include "components/leveldb/public/interfaces/leveldb.mojom.h" | 10 #include "components/leveldb/public/interfaces/leveldb.mojom.h" |
| 10 #include "components/profile_service/public/interfaces/profile.mojom.h" | 11 #include "components/profile_service/public/interfaces/profile.mojom.h" |
| 11 #include "mojo/public/cpp/bindings/binding_set.h" | 12 #include "mojo/public/cpp/bindings/binding_set.h" |
| 12 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 13 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
| 13 #include "mojo/shell/public/cpp/interface_factory.h" | 14 #include "mojo/shell/public/cpp/interface_factory.h" |
| 15 #include "mojo/shell/public/cpp/message_loop_ref.h" | |
| 14 #include "mojo/shell/public/cpp/shell_client.h" | 16 #include "mojo/shell/public/cpp/shell_client.h" |
| 15 | 17 |
| 16 namespace filesystem { | 18 namespace filesystem { |
| 17 class LockTable; | 19 class LockTable; |
| 18 } | 20 } |
| 19 | 21 |
| 20 namespace profile { | 22 namespace profile { |
| 23 class LevelDBThread; | |
| 21 | 24 |
| 22 scoped_ptr<mojo::ShellClient> CreateProfileApp(); | 25 scoped_ptr<mojo::ShellClient> CreateProfileApp(); |
| 23 | 26 |
| 24 // Application which hands off per-profile services. | 27 // Application which hands off per-profile services. |
| 25 // | 28 // |
| 26 // This Application serves ProfileService, and serves LevelDBService since most | 29 // This Application serves ProfileService. In the future, this application will |
| 27 // of the users of leveldb will want to write directly to the Directory | 30 // probably also offer any service that most Profile using applications will |
| 28 // provided by the ProfileService; we want file handling to be done in the same | 31 // need, such as preferences, but these will need to be served off of separate |
|
Ben Goodger (Google)
2016/03/11 23:21:38
Why make the generic statement that all interfaces
Elliot Glaysher
2016/03/14 20:33:20
Removed comment about threading.
| |
| 29 // process to minimize IPC. | 32 // threads; this class will have to be made into a application which is an |
| 30 // | 33 // InterfaceProvider which internally spawns threads for different |
| 31 // In the future, this application will probably also offer any service that | 34 // sub-applications. |
| 32 // most Profile using applications will need, such as preferences. | |
| 33 class ProfileApp : public mojo::ShellClient, | 35 class ProfileApp : public mojo::ShellClient, |
| 34 public mojo::InterfaceFactory<ProfileService>, | 36 public mojo::InterfaceFactory<ProfileService>, |
| 35 public mojo::InterfaceFactory<leveldb::LevelDBService> { | 37 public mojo::InterfaceFactory<leveldb::LevelDBService> { |
| 36 public: | 38 public: |
| 37 ProfileApp(); | 39 ProfileApp(); |
| 38 ~ProfileApp() override; | 40 ~ProfileApp() override; |
| 39 | 41 |
| 40 // Currently, ProfileApp is run from within the chrome process. This means it | 42 // Currently, ProfileApp is run from within the chrome process. This means it |
| 41 // that the ApplicationLoader is registered during MojoShellContext startup, | 43 // that the ApplicationLoader is registered during MojoShellContext startup, |
| 42 // even though the application itself is not started. As soon as a | 44 // even though the application itself is not started. As soon as a |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 66 | 68 |
| 67 // |InterfaceFactory<LevelDBService>| implementation: | 69 // |InterfaceFactory<LevelDBService>| implementation: |
| 68 void Create(mojo::Connection* connection, | 70 void Create(mojo::Connection* connection, |
| 69 leveldb::LevelDBServiceRequest request) override; | 71 leveldb::LevelDBServiceRequest request) override; |
| 70 | 72 |
| 71 mojo::TracingImpl tracing_; | 73 mojo::TracingImpl tracing_; |
| 72 | 74 |
| 73 scoped_ptr<ProfileService> profile_service_; | 75 scoped_ptr<ProfileService> profile_service_; |
| 74 mojo::BindingSet<ProfileService> profile_bindings_; | 76 mojo::BindingSet<ProfileService> profile_bindings_; |
| 75 | 77 |
| 76 scoped_ptr<leveldb::LevelDBService> leveldb_service_; | 78 scoped_ptr<filesystem::LockTable> lock_table_; |
| 77 mojo::BindingSet<leveldb::LevelDBService> leveldb_bindings_; | 79 base::FilePath profile_data_dir_; |
| 78 | 80 |
| 79 scoped_ptr<filesystem::LockTable> lock_table_; | 81 scoped_refptr<LevelDBThread> leveldb_thread_; |
| 80 | 82 |
| 81 base::FilePath profile_data_dir_; | 83 mojo::MessageLoopRefFactory ref_factory_; |
| 82 | 84 |
| 83 DISALLOW_COPY_AND_ASSIGN(ProfileApp); | 85 DISALLOW_COPY_AND_ASSIGN(ProfileApp); |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 } // namespace profile | 88 } // namespace profile |
| 87 | 89 |
| 88 #endif // COMPONENTS_PROFILE_SERVICE_PROFILE_APP_H_ | 90 #endif // COMPONENTS_PROFILE_SERVICE_PROFILE_APP_H_ |
| OLD | NEW |