Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: components/filesystem/file_system_app.h

Issue 1231493002: mandoline filesystem: Save cookie data to the mojo:filesystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT for jam's core services patch. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/filesystem/file_system_app.h
diff --git a/components/filesystem/file_system_app.h b/components/filesystem/file_system_app.h
index c636c54dbc745f03d95bea3e12c2b849a1a029ed..b7f417b328b57aa0e3caaca4028145355270e7f0 100644
--- a/components/filesystem/file_system_app.h
+++ b/components/filesystem/file_system_app.h
@@ -6,11 +6,16 @@
#define COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_
#include "base/macros.h"
+#include "components/filesystem/directory_impl.h"
#include "components/filesystem/file_system_impl.h"
#include "components/filesystem/public/interfaces/file_system.mojom.h"
#include "mojo/application/public/cpp/application_delegate.h"
#include "mojo/application/public/cpp/interface_factory.h"
+namespace mojo {
+class ApplicationImpl;
+}
+
namespace filesystem {
class FileSystemApp : public mojo::ApplicationDelegate,
@@ -19,15 +24,47 @@ class FileSystemApp : public mojo::ApplicationDelegate,
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. When we
+ // actually take a
jam 2015/07/13 15:48:33 nit: rest of comment?
+ void OnDirectoryConnectionError(DirectoryImpl* directory);
+
// |ApplicationDelegate| override:
+ void Initialize(mojo::ApplicationImpl* app) override;
bool ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) override;
+ bool OnShellConnectionError() override;
// |InterfaceFactory<Files>| implementation:
void Create(mojo::ApplicationConnection* 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::ApplicationImpl* app_;
+
+ // 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);
};

Powered by Google App Engine
This is Rietveld 408576698