OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef SERVICES_FILES_C_LIB_SINGLETONS_H_ | |
6 #define SERVICES_FILES_C_LIB_SINGLETONS_H_ | |
7 | |
8 #include "files/public/interfaces/directory.mojom.h" | |
9 | |
10 namespace mojio { | |
11 | |
12 class DirectoryWrapper; | |
13 class ErrnoImpl; | |
14 class FDTable; | |
15 | |
16 namespace singletons { | |
17 | |
18 // Gets the singleton |ErrnoImpl| (creating it if necessary), which gets/sets | |
19 // the "real" errno. | |
20 ErrnoImpl* GetErrnoImpl(); | |
21 // Resets (destroys) the singleton |ErrnoImpl|. Warning: Do not call this unless | |
22 // things relying on the singleton |ErrnoImpl| have been reset first. | |
23 void ResetErrnoImpl(); | |
24 | |
25 // Gets the singleton |FDTable| (creating it if necessary, using | |
26 // MOJIO_CONFIG_MAX_NUM_FDS and the singleton |ErrnoImpl|). | |
27 FDTable* GetFDTable(); | |
28 // Resets (destroys) the singleton |FDTable|. | |
29 void ResetFDTable(); | |
30 | |
31 // Explicitly set the singleton current working directory to |directory| (which | |
32 // should be valid). (The singleton |DirectoryWrapper| will be reset if | |
33 // necessary.) This uses the singleton |ErrnoImpl|. | |
34 void SetCurrentWorkingDirectory(mojo::files::DirectoryPtr directory); | |
35 // Gets the current working directory (i.e., the singleton |DirectoryWrapper|). | |
36 // WARNING!!! This returns null if it was not previously set (see above) or has | |
37 // been reset, in which case it will also use the singleton |ErrnoImpl| (to set | |
38 // errno). | |
39 DirectoryWrapper* GetCurrentWorkingDirectory(); | |
40 // Resets (destroys) the singleton |DirectoryWrapper|. | |
41 void ResetCurrentWorkingDirectory(); | |
42 | |
43 } // namespace singletons | |
44 } // namespace mojio | |
45 | |
46 #endif // SERVICES_FILES_C_LIB_SINGLETONS_H_ | |
OLD | NEW |