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

Side by Side Diff: sql/mojo/mojo_vfs.h

Issue 1176653002: mandoline filesystem: add a sqlite3 vfs to proxy filesystem usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win 8 Created 5 years, 6 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 | « sql/mojo/DEPS ('k') | sql/mojo/mojo_vfs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 SQL_MOJO_MOJO_VFS_H_
6 #define SQL_MOJO_MOJO_VFS_H_
7
8 #include "base/macros.h"
9 #include "components/filesystem/public/interfaces/directory.mojom.h"
10
11 typedef struct sqlite3_vfs sqlite3_vfs;
12
13 namespace sql {
14
15 // Changes the default sqlite3 vfs to a vfs that uses proxies calls to the
16 // mojo:filesystem service. Instantiating this object transparently changes how
17 // the entire //sql/ subsystem works in the process of the caller; all paths
18 // are treated as relative to |directory|.
19 class ScopedMojoFilesystemVFS {
20 public:
21 explicit ScopedMojoFilesystemVFS(filesystem::DirectoryPtr directory);
22 ~ScopedMojoFilesystemVFS();
23
24 // Returns the directory of the current VFS.
25 filesystem::DirectoryPtr& GetDirectory();
26
27 private:
28 friend sqlite3_vfs* GetParentVFS(sqlite3_vfs* mojo_vfs);
29 friend filesystem::DirectoryPtr& GetRootDirectory(sqlite3_vfs* mojo_vfs);
30
31 // The default vfs at the time MojoVFS was installed. We use the to pass
32 // through things like randomness requests and per-platform sleep calls.
33 sqlite3_vfs* parent_;
34
35 // When we initialize the subsystem, we are given a filesystem::Directory
36 // object, which is the root directory of a mojo:filesystem. All access to
37 // various files are specified from this root directory.
38 filesystem::DirectoryPtr root_directory_;
39
40 DISALLOW_COPY_AND_ASSIGN(ScopedMojoFilesystemVFS);
41 };
42
43 } // namespace sql
44
45 #endif // SQL_MOJO_MOJO_VFS_H_
OLDNEW
« no previous file with comments | « sql/mojo/DEPS ('k') | sql/mojo/mojo_vfs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698