| Index: third_party/sqlite/patches/0005-Modify-default-VFS-to-support-WebDatabase.patch
|
| diff --git a/third_party/sqlite/webdb.patch b/third_party/sqlite/patches/0005-Modify-default-VFS-to-support-WebDatabase.patch
|
| similarity index 60%
|
| rename from third_party/sqlite/webdb.patch
|
| rename to third_party/sqlite/patches/0005-Modify-default-VFS-to-support-WebDatabase.patch
|
| index 6a4e934f46561fb50e20e4a0b1146b53453d1155..45d6b25757c678de77d81cb8717a1d37384c7746 100644
|
| --- a/third_party/sqlite/webdb.patch
|
| +++ b/third_party/sqlite/patches/0005-Modify-default-VFS-to-support-WebDatabase.patch
|
| @@ -1,31 +1,44 @@
|
| -The WebDatabase implementation in the renderer users a custom vfs to
|
| -broker file open and other requests. This modifies the built-in vfs
|
| -implementation to let that code share much of the implementation
|
| -details.
|
| +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 05/16] Modify default VFS to support WebDatabase.
|
|
|
| -diff --git src/os_unix.c src/os_unix.c
|
| -index ef04a72..e5e1509 100644
|
| ---- src/os_unix.c
|
| -+++ src/os_unix.c
|
| -@@ -3496,9 +3496,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));
|
| -+}
|
| +The renderer WebDatabase implementation needs to broker certain requests
|
| +to the browser. This modifies SQLite to allow monkey-patching the VFS
|
| +to support this.
|
| +
|
| +NOTE(shess): This patch relies on core SQLite implementation details
|
| +remaining unchanged. When importing a new version of SQLite, pay very
|
| +close attention to whether the change is still doing what is intended.
|
| +
|
| +Original review URLs:
|
| +https://codereview.chromium.org/159044
|
| +https://codereview.chromium.org/384075
|
| +https://codereview.chromium.org/377039
|
| +[Possibly not a complete list.]
|
| +---
|
| + third_party/sqlite/src/src/os_unix.c | 95 ++++++++++++++++++++++++++++++------
|
| + third_party/sqlite/src/src/os_win.c | 7 +++
|
| + 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 a9344ee..1624f6a 100644
|
| +--- a/third_party/sqlite/src/src/os_unix.c
|
| ++++ b/third_party/sqlite/src/src/os_unix.c
|
| +@@ -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 */
|
| -@@ -3812,6 +3819,73 @@ static UnixUnusedFd *findReusableFd(const char *zPath, int flags){
|
| ++ /* TODO(shess): This check doesn't work when the Chromium's WebDB code is
|
| ++ ** running in the sandbox.
|
| ++ */
|
| ++ return 0;
|
| ++
|
| + return pFile->pInode!=0 &&
|
| + (osStat(pFile->zPath, &buf)!=0 || buf.st_ino!=pFile->pInode->fileId.ino);
|
| + #endif
|
| +@@ -5615,6 +5621,73 @@ static int findCreateFileMode(
|
| }
|
|
|
| /*
|
| @@ -40,9 +53,9 @@ index ef04a72..e5e1509 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);
|
| +}
|
| +
|
| +/*
|
| @@ -99,9 +112,9 @@ index ef04a72..e5e1509 100644
|
| ** Open the file zPath.
|
| **
|
| ** Previously, the SQLite OS layer used three functions in place of this
|
| -@@ -3893,20 +3967,13 @@ static int unixOpen(
|
| - || eType==SQLITE_OPEN_TRANSIENT_DB
|
| - );
|
| +@@ -5715,20 +5788,13 @@ static int unixOpen(
|
| + sqlite3_randomness(0,0);
|
| + }
|
|
|
| - memset(p, 0, sizeof(unixFile));
|
| + chromium_sqlite3_initialize_unix_sqlite3_file(pFile);
|
| @@ -121,10 +134,10 @@ index ef04a72..e5e1509 100644
|
| + return rc;
|
| }
|
| - p->pUnused = pUnused;
|
| - }else if( !zName ){
|
| - /* If zName is NULL, the upper layer is requesting a temp file. */
|
| - assert(isDelete && !isOpenDirectory);
|
| -@@ -3949,10 +4016,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;
|
| }
|
|
|
| @@ -136,8 +149,8 @@ index ef04a72..e5e1509 100644
|
|
|
| if( isDelete ){
|
| #if OS_VXWORKS
|
| -@@ -4028,7 +4092,7 @@ static int unixOpen(
|
| - rc = fillInUnixFile(pVfs, fd, dirfd, pFile, zPath, noLock, isDelete);
|
| +@@ -5893,7 +5956,7 @@ static int unixOpen(
|
| +
|
| open_finished:
|
| if( rc!=SQLITE_OK ){
|
| - sqlite3_free(p->pUnused);
|
| @@ -145,11 +158,11 @@ index ef04a72..e5e1509 100644
|
| }
|
| return rc;
|
| }
|
| -diff --git src/os_win.c src/os_win.c
|
| -index bc03a4b..06539d7 100644
|
| ---- src/os_win.c
|
| -+++ src/os_win.c
|
| -@@ -1890,4 +1890,11 @@ int sqlite3_os_end(void){
|
| +diff --git a/third_party/sqlite/src/src/os_win.c b/third_party/sqlite/src/src/os_win.c
|
| +index 8ca2107..5b0a296 100644
|
| +--- a/third_party/sqlite/src/src/os_win.c
|
| ++++ b/third_party/sqlite/src/src/os_win.c
|
| +@@ -5546,4 +5546,11 @@ int sqlite3_os_end(void){
|
| return SQLITE_OK;
|
| }
|
|
|
| @@ -161,3 +174,6 @@ index bc03a4b..06539d7 100644
|
| +}
|
| +
|
| #endif /* SQLITE_OS_WIN */
|
| +--
|
| +2.2.1
|
| +
|
|
|