Index: components/profile_service/profile_app.h |
diff --git a/components/profile_service/profile_app.h b/components/profile_service/profile_app.h |
index 8da3f56e5c1046634c664989ebaed41297d15731..2e6108738a931da363d0597f48433861d401d642 100644 |
--- a/components/profile_service/profile_app.h |
+++ b/components/profile_service/profile_app.h |
@@ -5,6 +5,7 @@ |
#ifndef COMPONENTS_PROFILE_SERVICE_PROFILE_APP_H_ |
#define COMPONENTS_PROFILE_SERVICE_PROFILE_APP_H_ |
+#include "base/memory/ref_counted.h" |
#include "components/filesystem/lock_table.h" |
#include "components/leveldb/public/interfaces/leveldb.mojom.h" |
#include "components/profile_service/public/interfaces/profile.mojom.h" |
@@ -13,46 +14,28 @@ |
#include "mojo/shell/public/cpp/interface_factory.h" |
#include "mojo/shell/public/cpp/shell_client.h" |
-namespace filesystem { |
-class LockTable; |
-} |
- |
namespace profile { |
-scoped_ptr<mojo::ShellClient> CreateProfileApp(); |
+scoped_ptr<mojo::ShellClient> CreateProfileApp( |
+ scoped_refptr<base::SingleThreadTaskRunner> profile_service_runner, |
+ scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner); |
// Application which hands off per-profile services. |
// |
-// This Application serves ProfileService, and serves LevelDBService since most |
-// of the users of leveldb will want to write directly to the Directory |
-// provided by the ProfileService; we want file handling to be done in the same |
-// process to minimize IPC. |
-// |
-// In the future, this application will probably also offer any service that |
-// most Profile using applications will need, such as preferences. |
+// This Application serves ProfileService. In the future, this application will |
+// probably also offer any service that most Profile using applications will |
+// need, such as preferences; this class will have to be made into a |
+// application which is an InterfaceProvider which internally spawns threads |
+// for different sub-applications. |
class ProfileApp : public mojo::ShellClient, |
public mojo::InterfaceFactory<ProfileService>, |
public mojo::InterfaceFactory<leveldb::LevelDBService> { |
public: |
- ProfileApp(); |
+ ProfileApp( |
+ scoped_refptr<base::SingleThreadTaskRunner> profile_service_runner, |
+ scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner); |
~ProfileApp() override; |
- // Currently, ProfileApp is run from within the chrome process. This means it |
- // that the ApplicationLoader is registered during MojoShellContext startup, |
- // even though the application itself is not started. As soon as a |
- // BrowserContext is created, the BrowserContext will choose a |user_id| for |
- // itself and call us to register the mapping from |user_id| to |
- // |profile_data_dir|. |
- // |
- // This data is then accessed when we get our Initialize() call. |
- // |
- // TODO(erg): This is a temporary hack until we redo how we initialize mojo |
- // applications inside of chrome in general; this system won't work once |
- // ProfileApp gets put in its own sandboxed process. |
- static void AssociateMojoUserIDWithProfileDir( |
- const std::string& user_id, |
- const base::FilePath& profile_data_dir); |
- |
private: |
// |ShellClient| override: |
void Initialize(mojo::Connector* connector, |
@@ -68,17 +51,22 @@ class ProfileApp : public mojo::ShellClient, |
void Create(mojo::Connection* connection, |
leveldb::LevelDBServiceRequest request) override; |
- mojo::TracingImpl tracing_; |
+ void OnLevelDBServiceRequest(mojo::Connection* connection, |
+ leveldb::LevelDBServiceRequest request); |
+ void OnLevelDBServiceError(); |
- scoped_ptr<ProfileService> profile_service_; |
- mojo::BindingSet<ProfileService> profile_bindings_; |
+ scoped_refptr<base::SingleThreadTaskRunner> profile_service_runner_; |
+ scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner_; |
- scoped_ptr<leveldb::LevelDBService> leveldb_service_; |
- mojo::BindingSet<leveldb::LevelDBService> leveldb_bindings_; |
+ mojo::TracingImpl tracing_; |
- scoped_ptr<filesystem::LockTable> lock_table_; |
+ // We create these two objects so we can delete them on the correct task |
+ // runners. |
+ class ProfileServiceObjects; |
+ scoped_ptr<ProfileServiceObjects> profile_objects_; |
- base::FilePath profile_data_dir_; |
+ class LevelDBServiceObjects; |
+ scoped_ptr<LevelDBServiceObjects> leveldb_objects_; |
DISALLOW_COPY_AND_ASSIGN(ProfileApp); |
}; |