shess | 5f2c344 | 2017-01-24 02:15:10 | [diff] [blame] | 1 | // Copyright (c) 2017 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_VFS_WRAPPER_H_ |
| 6 | #define SQL_VFS_WRAPPER_H_ |
| 7 | |
Sergey Ulanov | 7de7e9f | 2019-03-09 00:41:02 | [diff] [blame] | 8 | #include <string> |
| 9 | |
| 10 | #include "build/build_config.h" |
shess | 5f2c344 | 2017-01-24 02:15:10 | [diff] [blame] | 11 | #include "third_party/sqlite/sqlite3.h" |
| 12 | |
| 13 | namespace sql { |
| 14 | |
| 15 | // A wrapper around the default VFS. |
| 16 | // |
| 17 | // On OSX, the wrapper propagates Time Machine exclusions from the main database |
| 18 | // file to associated files such as journals. <http://crbug.com/23619> and |
| 19 | // <http://crbug.com/25959> and others. |
| 20 | // |
Sergey Ulanov | 7de7e9f | 2019-03-09 00:41:02 | [diff] [blame] | 21 | // On Fuchsia the wrapper adds in-process file locking (Fuchsia doesn't support |
| 22 | // file locking). |
| 23 | // |
shess | 5f2c344 | 2017-01-24 02:15:10 | [diff] [blame] | 24 | // TODO(shess): On Windows, wrap xFetch() with a structured exception handler. |
| 25 | sqlite3_vfs* VFSWrapper(); |
| 26 | |
Sergey Ulanov | 7de7e9f | 2019-03-09 00:41:02 | [diff] [blame] | 27 | // Internal representation of sqlite3_file for VFSWrapper. |
| 28 | struct VfsFile { |
| 29 | const sqlite3_io_methods* methods; |
| 30 | sqlite3_file* wrapped_file; |
| 31 | #if defined(OS_FUCHSIA) |
| 32 | std::string file_name; |
| 33 | int lock_level; |
| 34 | #endif |
| 35 | }; |
| 36 | |
shess | 5f2c344 | 2017-01-24 02:15:10 | [diff] [blame] | 37 | } // namespace sql |
| 38 | |
| 39 | #endif // SQL_VFS_WRAPPER_H_ |