| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 WEBKIT_DATABASE_VFS_BACKEND_H_ | 5 #ifndef WEBKIT_DATABASE_VFS_BACKEND_H_ |
| 6 #define WEBKIT_DATABASE_VFS_BACKEND_H_ | 6 #define WEBKIT_DATABASE_VFS_BACKEND_H_ |
| 7 | 7 |
| 8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
| 9 #include "base/process.h" | 9 #include "base/process.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 | 11 |
| 12 class FilePath; | 12 class FilePath; |
| 13 | 13 |
| 14 namespace webkit_database { | 14 namespace webkit_database { |
| 15 | 15 |
| 16 class VfsBackend { | 16 class VfsBackend { |
| 17 public: | 17 public: |
| 18 static void GetFileHandleForProcess(base::ProcessHandle process_handle, | |
| 19 const base::PlatformFile& file_handle, | |
| 20 base::PlatformFile* target_handle, | |
| 21 bool close_source_handle); | |
| 22 | |
| 23 static void OpenFile(const FilePath& file_path, | 18 static void OpenFile(const FilePath& file_path, |
| 24 int desired_flags, | 19 int desired_flags, |
| 25 base::PlatformFile* file_handle); | 20 base::PlatformFile* file_handle); |
| 26 | 21 |
| 27 static void OpenTempFileInDirectory(const FilePath& dir_path, | 22 static void OpenTempFileInDirectory(const FilePath& dir_path, |
| 28 int desired_flags, | 23 int desired_flags, |
| 29 base::PlatformFile* file_handle); | 24 base::PlatformFile* file_handle); |
| 30 | 25 |
| 31 static int DeleteFile(const FilePath& file_path, bool sync_dir); | 26 static int DeleteFile(const FilePath& file_path, bool sync_dir); |
| 32 | 27 |
| 33 static uint32 GetFileAttributes(const FilePath& file_path); | 28 static uint32 GetFileAttributes(const FilePath& file_path); |
| 34 | 29 |
| 35 static int64 GetFileSize(const FilePath& file_path); | 30 static int64 GetFileSize(const FilePath& file_path); |
| 36 | 31 |
| 37 // Used to make decisions in the DatabaseDispatcherHost. | 32 // Used to make decisions in the DatabaseDispatcherHost. |
| 38 static bool FileTypeIsMainDB(int desired_flags); | 33 static bool FileTypeIsMainDB(int desired_flags); |
| 39 static bool FileTypeIsJournal(int desired_flags); | 34 static bool FileTypeIsJournal(int desired_flags); |
| 40 static bool OpenTypeIsReadWrite(int desired_flags); | 35 static bool OpenTypeIsReadWrite(int desired_flags); |
| 41 | 36 |
| 42 private: | 37 private: |
| 43 static bool OpenFileFlagsAreConsistent(int desired_flags); | 38 static bool OpenFileFlagsAreConsistent(int desired_flags); |
| 44 }; | 39 }; |
| 45 | 40 |
| 46 } // namespace webkit_database | 41 } // namespace webkit_database |
| 47 | 42 |
| 48 #endif // WEBKIT_DATABASE_VFS_BACKEND_H_ | 43 #endif // WEBKIT_DATABASE_VFS_BACKEND_H_ |
| OLD | NEW |