vfs_wrapper_fuchsia.h 1.1 KB

123456789101112131415161718192021222324252627
  1. // Copyright 2019 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. #ifndef SQL_VFS_WRAPPER_FUCHSIA_H_
  5. #define SQL_VFS_WRAPPER_FUCHSIA_H_
  6. #include "third_party/sqlite/sqlite3.h"
  7. namespace sql {
  8. // Fuchsia doesn't provide a file locking mechanism like flock(). These
  9. // functions are used to simulate file locking. On Fuchsia profile directories
  10. // are not expected to be shared with other processes and therefore only one
  11. // browser process may access sqlite files. These functions are designed to
  12. // handle the case when the same sqlite database is open more than once from the
  13. // same browser process. In most cases databases do not need to be open more
  14. // than once, i.e. contention is expected to be rare, so the main goal of the
  15. // design is simplicity and not performance. The manager maintains a list of all
  16. // currently locked files.
  17. int Lock(sqlite3_file* sqlite_file, int file_lock);
  18. int Unlock(sqlite3_file* sqlite_file, int file_lock);
  19. int CheckReservedLock(sqlite3_file* sqlite_file, int* result);
  20. } // namespace sql
  21. #endif // SQL_VFS_WRAPPER_FUCHSIA_H_