Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "webkit/database/vfs_backend.h" | 5 #include "webkit/database/vfs_backend.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "third_party/sqlite/sqlite3.h" | 10 #include "third_party/sqlite/sqlite3.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 if (desired_flags & SQLITE_OPEN_EXCLUSIVE) { | 96 if (desired_flags & SQLITE_OPEN_EXCLUSIVE) { |
| 97 flags |= base::PLATFORM_FILE_EXCLUSIVE_READ | | 97 flags |= base::PLATFORM_FILE_EXCLUSIVE_READ | |
| 98 base::PLATFORM_FILE_EXCLUSIVE_WRITE; | 98 base::PLATFORM_FILE_EXCLUSIVE_WRITE; |
| 99 } | 99 } |
| 100 | 100 |
| 101 if (desired_flags & SQLITE_OPEN_DELETEONCLOSE) { | 101 if (desired_flags & SQLITE_OPEN_DELETEONCLOSE) { |
| 102 flags |= base::PLATFORM_FILE_TEMPORARY | base::PLATFORM_FILE_HIDDEN | | 102 flags |= base::PLATFORM_FILE_TEMPORARY | base::PLATFORM_FILE_HIDDEN | |
| 103 base::PLATFORM_FILE_DELETE_ON_CLOSE; | 103 base::PLATFORM_FILE_DELETE_ON_CLOSE; |
| 104 } | 104 } |
| 105 | 105 |
| 106 // This flag will allow us to delete the file later on from the browser | |
| 107 // process. | |
| 108 flags |= base::PLATFORM_FILE_SHARE_DELETE; | |
|
michaeln
2011/07/01 03:02:34
Please try this on the layout test try bots too. I
jochen (gone - plz use gerrit)
2011/07/06 09:24:53
I'll do that, however, test_shell_tests is already
| |
| 109 | |
| 106 // Try to open/create the DB file. | 110 // Try to open/create the DB file. |
| 107 *file_handle = | 111 *file_handle = |
| 108 base::CreatePlatformFile(file_path, flags, NULL, NULL); | 112 base::CreatePlatformFile(file_path, flags, NULL, NULL); |
| 109 } | 113 } |
| 110 | 114 |
| 111 // static | 115 // static |
| 112 void VfsBackend::OpenTempFileInDirectory( | 116 void VfsBackend::OpenTempFileInDirectory( |
| 113 const FilePath& dir_path, | 117 const FilePath& dir_path, |
| 114 int desired_flags, | 118 int desired_flags, |
| 115 base::PlatformFile* file_handle) { | 119 base::PlatformFile* file_handle) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 return attributes; | 172 return attributes; |
| 169 } | 173 } |
| 170 | 174 |
| 171 // static | 175 // static |
| 172 int64 VfsBackend::GetFileSize(const FilePath& file_path) { | 176 int64 VfsBackend::GetFileSize(const FilePath& file_path) { |
| 173 int64 size = 0; | 177 int64 size = 0; |
| 174 return (file_util::GetFileSize(file_path, &size) ? size : 0); | 178 return (file_util::GetFileSize(file_path, &size) ? size : 0); |
| 175 } | 179 } |
| 176 | 180 |
| 177 } // namespace webkit_database | 181 } // namespace webkit_database |
| OLD | NEW |