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

Unified Diff: third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteFileSystemPosix.cpp

Issue 1485603003: Revert of "[sql] Remove part of WebDatabase SQLite patch." (patchset #1 of https://codereview.chrom… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/sqlite/amalgamation/sqlite3.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteFileSystemPosix.cpp
diff --git a/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteFileSystemPosix.cpp b/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteFileSystemPosix.cpp
index fda7d6c85907bd7e7bf97aa23b472ed2ccb44512..a1921a07867550c3d98ccbfbf4eb301ad07f8fdd 100644
--- a/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteFileSystemPosix.cpp
+++ b/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteFileSystemPosix.cpp
@@ -143,10 +143,17 @@ int chromiumDeviceCharacteristics(sqlite3_file* sqliteFile)
int chromiumOpenInternal(sqlite3_vfs* vfs, const char* fileName, sqlite3_file* id, int desiredFlags, int* usedFlags)
{
chromium_sqlite3_initialize_unix_sqlite3_file(id);
- int fd = Platform::current()->databaseOpenFile(String(fileName), desiredFlags);
- if ((fd < 0) && (desiredFlags & SQLITE_OPEN_READWRITE)) {
- int newFlags = (desiredFlags & ~(SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)) | SQLITE_OPEN_READONLY;
- fd = Platform::current()->databaseOpenFile(String(fileName), newFlags);
+ int fd = -1;
+ int result = chromium_sqlite3_get_reusable_file_handle(id, fileName, desiredFlags, &fd);
+ if (result != SQLITE_OK)
+ return result;
+
+ if (fd < 0) {
+ fd = Platform::current()->databaseOpenFile(String(fileName), desiredFlags);
+ if ((fd < 0) && (desiredFlags & SQLITE_OPEN_READWRITE)) {
+ int newFlags = (desiredFlags & ~(SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)) | SQLITE_OPEN_READONLY;
+ fd = Platform::current()->databaseOpenFile(String(fileName), newFlags);
+ }
}
if (fd < 0) {
chromium_sqlite3_destroy_reusable_file_handle(id);
@@ -163,7 +170,7 @@ int chromiumOpenInternal(sqlite3_vfs* vfs, const char* fileName, sqlite3_file* i
int fileType = desiredFlags & 0x00007F00;
int noLock = (fileType != SQLITE_OPEN_MAIN_DB);
sqlite3_vfs* wrappedVfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- int result = chromium_sqlite3_fill_in_unix_sqlite3_file(wrappedVfs, fd, -1, id, fileName, noLock);
+ result = chromium_sqlite3_fill_in_unix_sqlite3_file(wrappedVfs, fd, -1, id, fileName, noLock);
if (result != SQLITE_OK)
chromium_sqlite3_destroy_reusable_file_handle(id);
return result;
« no previous file with comments | « no previous file | third_party/sqlite/amalgamation/sqlite3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698