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

Side by Side Diff: components/filesystem/file_system_app.h

Issue 1708253004: mojo: Get mojo:leveldb and mojo:filesystem compiled into content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Probable fix to the build flake. Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « components/filesystem/BUILD.gn ('k') | components/filesystem/file_system_app.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_FILESYSTEM_FILE_SYSTEM_APP_H_ 5 #ifndef COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_
6 #define COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_ 6 #define COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "components/filesystem/directory_impl.h" 9 #include "components/filesystem/directory_impl.h"
10 #include "components/filesystem/file_system_impl.h" 10 #include "components/filesystem/file_system_impl.h"
11 #include "components/filesystem/lock_table.h" 11 #include "components/filesystem/lock_table.h"
12 #include "components/filesystem/public/interfaces/file_system.mojom.h" 12 #include "components/filesystem/public/interfaces/file_system.mojom.h"
13 #include "mojo/services/tracing/public/cpp/tracing_impl.h" 13 #include "mojo/services/tracing/public/cpp/tracing_impl.h"
14 #include "mojo/shell/public/cpp/interface_factory.h" 14 #include "mojo/shell/public/cpp/interface_factory.h"
15 #include "mojo/shell/public/cpp/shell_client.h" 15 #include "mojo/shell/public/cpp/shell_client.h"
16 16
17 namespace mojo { 17 namespace mojo {
18 class Shell; 18 class Shell;
19 } 19 }
20 20
21 namespace filesystem { 21 namespace filesystem {
22 22
23 class FileSystemApp : public mojo::ShellClient, 23 class FileSystemApp : public mojo::ShellClient,
24 public mojo::InterfaceFactory<FileSystem> { 24 public mojo::InterfaceFactory<FileSystem> {
25 public: 25 public:
26 FileSystemApp(); 26 FileSystemApp();
27 ~FileSystemApp() override; 27 ~FileSystemApp() override;
28 28
29 // Called by individual FileSystem objects to register lifetime events.
30 void RegisterDirectoryToClient(DirectoryImpl* directory,
31 FileSystemClientPtr client);
32
33 private: 29 private:
34 // We set the DirectoryImpl's error handler to this function. We do this so
35 // that we can QuitNow() once the last DirectoryImpl has closed itself.
36 void OnDirectoryConnectionError(DirectoryImpl* directory);
37
38 // |mojo::ShellClient| override: 30 // |mojo::ShellClient| override:
39 void Initialize(mojo::Shell* shell, const std::string& url, 31 void Initialize(mojo::Shell* shell, const std::string& url,
40 uint32_t id) override; 32 uint32_t id) override;
41 bool AcceptConnection(mojo::Connection* connection) override; 33 bool AcceptConnection(mojo::Connection* connection) override;
42 bool ShellConnectionLost() override;
43 34
44 // |InterfaceFactory<Files>| implementation: 35 // |InterfaceFactory<Files>| implementation:
45 void Create(mojo::Connection* connection, 36 void Create(mojo::Connection* connection,
46 mojo::InterfaceRequest<FileSystem> request) override; 37 mojo::InterfaceRequest<FileSystem> request) override;
47 38
48 // Use a vector to work around map not letting us use FileSystemClientPtr as
49 // a value in a std::map. The move constructors are to allow us to deal with
50 // FileSystemClientPtr inside a vector.
51 struct Client {
52 Client(DirectoryImpl* directory, FileSystemClientPtr fs_client);
53 Client(Client&& rhs);
54 ~Client();
55
56 Client& operator=(Client&& rhs);
57
58 DirectoryImpl* directory_;
59 FileSystemClientPtr fs_client_;
60 };
61 std::vector<Client> client_mapping_;
62
63 mojo::Shell* shell_; 39 mojo::Shell* shell_;
64 mojo::TracingImpl tracing_; 40 mojo::TracingImpl tracing_;
65 41
66 scoped_ptr<LockTable> lock_table_; 42 scoped_ptr<LockTable> lock_table_;
67 43
68 // Set to true when our shell connection is closed. On connection error, we
69 // then broadcast a notification to all FileSystemClients that they should
70 // shut down. Once the final one does, then we QuitNow().
71 bool in_shutdown_;
72
73 DISALLOW_COPY_AND_ASSIGN(FileSystemApp); 44 DISALLOW_COPY_AND_ASSIGN(FileSystemApp);
74 }; 45 };
75 46
76 } // namespace filesystem 47 } // namespace filesystem
77 48
78 #endif // COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_ 49 #endif // COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_
OLDNEW
« no previous file with comments | « components/filesystem/BUILD.gn ('k') | components/filesystem/file_system_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698