Index: components/filesystem/file_system_app.h |
diff --git a/components/filesystem/file_system_app.h b/components/filesystem/file_system_app.h |
index ae624691e7d70c86f1de7d869fe53d4d7c95ded6..402c3599eaeb8ccce13b3159d216ccbf9c05a3d3 100644 |
--- a/components/filesystem/file_system_app.h |
+++ b/components/filesystem/file_system_app.h |
@@ -26,20 +26,49 @@ |
FileSystemApp(); |
~FileSystemApp() override; |
+ // Called by individual FileSystem objects to register lifetime events. |
+ void RegisterDirectoryToClient(DirectoryImpl* directory, |
+ FileSystemClientPtr client); |
+ |
private: |
+ // We set the DirectoryImpl's error handler to this function. We do this so |
+ // that we can QuitNow() once the last DirectoryImpl has closed itself. |
+ void OnDirectoryConnectionError(DirectoryImpl* directory); |
+ |
// |mojo::ShellClient| override: |
void Initialize(mojo::Shell* shell, const std::string& url, |
uint32_t id) override; |
bool AcceptConnection(mojo::Connection* connection) override; |
+ bool ShellConnectionLost() override; |
// |InterfaceFactory<Files>| implementation: |
void Create(mojo::Connection* connection, |
mojo::InterfaceRequest<FileSystem> request) override; |
+ // Use a vector to work around map not letting us use FileSystemClientPtr as |
+ // a value in a std::map. The move constructors are to allow us to deal with |
+ // FileSystemClientPtr inside a vector. |
+ struct Client { |
+ Client(DirectoryImpl* directory, FileSystemClientPtr fs_client); |
+ Client(Client&& rhs); |
+ ~Client(); |
+ |
+ Client& operator=(Client&& rhs); |
+ |
+ DirectoryImpl* directory_; |
+ FileSystemClientPtr fs_client_; |
+ }; |
+ std::vector<Client> client_mapping_; |
+ |
mojo::Shell* shell_; |
mojo::TracingImpl tracing_; |
scoped_ptr<LockTable> lock_table_; |
+ |
+ // Set to true when our shell connection is closed. On connection error, we |
+ // then broadcast a notification to all FileSystemClients that they should |
+ // shut down. Once the final one does, then we QuitNow(). |
+ bool in_shutdown_; |
DISALLOW_COPY_AND_ASSIGN(FileSystemApp); |
}; |