Chromium Code Reviews| Index: third_party/sqlite/patches/0005-Modify-default-VFS-to-support-WebDatabase.patch |
| diff --git a/third_party/sqlite/patches/0006-Modify-default-VFS-to-support-WebDatabase.patch b/third_party/sqlite/patches/0005-Modify-default-VFS-to-support-WebDatabase.patch |
| similarity index 74% |
| rename from third_party/sqlite/patches/0006-Modify-default-VFS-to-support-WebDatabase.patch |
| rename to third_party/sqlite/patches/0005-Modify-default-VFS-to-support-WebDatabase.patch |
| index 4d2093307abff4334869b16b12c968d9d1a16c4b..45d6b25757c678de77d81cb8717a1d37384c7746 100644 |
| --- a/third_party/sqlite/patches/0006-Modify-default-VFS-to-support-WebDatabase.patch |
| +++ b/third_party/sqlite/patches/0005-Modify-default-VFS-to-support-WebDatabase.patch |
| @@ -1,7 +1,7 @@ |
| -From 25f1f784320aa0e32b69f78098b652b30df40865 Mon Sep 17 00:00:00 2001 |
| +From 67024286d2719aec049605896ef0afec6932f184 Mon Sep 17 00:00:00 2001 |
| From: dumi <dumi@chromium.org> |
| Date: Mon, 20 Jul 2009 23:40:51 +0000 |
| -Subject: [PATCH 06/23] Modify default VFS to support WebDatabase. |
| +Subject: [PATCH 05/16] Modify default VFS to support WebDatabase. |
| The renderer WebDatabase implementation needs to broker certain requests |
| to the browser. This modifies SQLite to allow monkey-patching the VFS |
| @@ -17,33 +17,28 @@ https://codereview.chromium.org/384075 |
| https://codereview.chromium.org/377039 |
| [Possibly not a complete list.] |
| --- |
| - third_party/sqlite/src/src/os_unix.c | 98 +++++++++++++++++++++++++++++------- |
| + third_party/sqlite/src/src/os_unix.c | 95 ++++++++++++++++++++++++++++++------ |
| third_party/sqlite/src/src/os_win.c | 7 +++ |
| - 2 files changed, 88 insertions(+), 17 deletions(-) |
| + 2 files changed, 86 insertions(+), 16 deletions(-) |
| diff --git a/third_party/sqlite/src/src/os_unix.c b/third_party/sqlite/src/src/os_unix.c |
| -index 998e353..766b52a 100644 |
| +index a9344ee..1624f6a 100644 |
| --- a/third_party/sqlite/src/src/os_unix.c |
| +++ b/third_party/sqlite/src/src/os_unix.c |
| -@@ -4418,9 +4418,16 @@ typedef const sqlite3_io_methods *(*finder_type)(const char*,unixFile*); |
| - */ |
| - |
| - /* |
| -+** Initializes a unixFile structure with zeros. |
| -+*/ |
| -+void initUnixFile(sqlite3_file* file) { |
| -+ memset(file, 0, sizeof(unixFile)); |
| -+} |
| +@@ -1321,6 +1321,12 @@ static int fileHasMoved(unixFile *pFile){ |
| + return pFile->pInode!=0 && pFile->pId!=pFile->pInode->fileId.pId; |
| + #else |
| + struct stat buf; |
| + |
| -+/* |
| - ** Initialize the contents of the unixFile structure pointed to by pId. |
| - */ |
| --static int fillInUnixFile( |
| -+int fillInUnixFile( |
| - sqlite3_vfs *pVfs, /* Pointer to vfs object */ |
| - int h, /* Open file descriptor of file being opened */ |
| - int dirfd, /* Directory file descriptor */ |
| -@@ -4834,6 +4841,73 @@ static int findCreateFileMode( |
| ++ /* TODO(shess): This check doesn't work when the Chromium's WebDB code is |
| ++ ** running in the sandbox. |
| ++ */ |
| ++ return 0; |
|
Scott Hess - ex-Googler
2015/02/04 22:28:48
This was the problem preventing WebDatabase from w
|
| ++ |
| + return pFile->pInode!=0 && |
| + (osStat(pFile->zPath, &buf)!=0 || buf.st_ino!=pFile->pInode->fileId.ino); |
| + #endif |
| +@@ -5615,6 +5621,73 @@ static int findCreateFileMode( |
| } |
| /* |
| @@ -58,9 +53,9 @@ index 998e353..766b52a 100644 |
| + int dirfd, |
| + sqlite3_file* file, |
| + const char* fileName, |
| -+ int noLock, |
| -+ int isDelete) { |
| -+ return fillInUnixFile(vfs, fd, dirfd, file, fileName, noLock, isDelete, 0); |
| ++ int noLock) { |
| ++ int ctrlFlags = (noLock ? UNIXFILE_NOLOCK : 0); |
| ++ return fillInUnixFile(vfs, fd, file, fileName, ctrlFlags); |
|
Scott Hess - ex-Googler
2015/02/04 22:28:48
I'm pretty nervous about this, but AFAICT there ar
|
| +} |
| + |
| +/* |
| @@ -117,9 +112,9 @@ index 998e353..766b52a 100644 |
| ** Open the file zPath. |
| ** |
| ** Previously, the SQLite OS layer used three functions in place of this |
| -@@ -4921,20 +4995,13 @@ static int unixOpen( |
| - || eType==SQLITE_OPEN_TRANSIENT_DB || eType==SQLITE_OPEN_WAL |
| - ); |
| +@@ -5715,20 +5788,13 @@ static int unixOpen( |
| + sqlite3_randomness(0,0); |
| + } |
| - memset(p, 0, sizeof(unixFile)); |
| + chromium_sqlite3_initialize_unix_sqlite3_file(pFile); |
| @@ -139,10 +134,10 @@ index 998e353..766b52a 100644 |
| + return rc; |
| } |
| - p->pUnused = pUnused; |
| - }else if( !zName ){ |
| - /* If zName is NULL, the upper layer is requesting a temp file. */ |
| - assert(isDelete && !isOpenDirectory); |
| -@@ -4984,10 +5051,7 @@ static int unixOpen( |
| + |
| + /* Database filenames are double-zero terminated if they are not |
| + ** URIs with parameters. Hence, they can always be passed into |
| +@@ -5798,10 +5864,7 @@ static int unixOpen( |
| *pOutFlags = flags; |
| } |
| @@ -154,8 +149,8 @@ index 998e353..766b52a 100644 |
| if( isDelete ){ |
| #if OS_VXWORKS |
| -@@ -5090,7 +5154,7 @@ static int unixOpen( |
| - isDelete, isReadonly); |
| +@@ -5893,7 +5956,7 @@ static int unixOpen( |
| + |
| open_finished: |
| if( rc!=SQLITE_OK ){ |
| - sqlite3_free(p->pUnused); |
| @@ -164,10 +159,10 @@ index 998e353..766b52a 100644 |
| return rc; |
| } |
| diff --git a/third_party/sqlite/src/src/os_win.c b/third_party/sqlite/src/src/os_win.c |
| -index c876833..78e58b5 100644 |
| +index 8ca2107..5b0a296 100644 |
| --- a/third_party/sqlite/src/src/os_win.c |
| +++ b/third_party/sqlite/src/src/os_win.c |
| -@@ -2784,4 +2784,11 @@ int sqlite3_os_end(void){ |
| +@@ -5546,4 +5546,11 @@ int sqlite3_os_end(void){ |
| return SQLITE_OK; |
| } |