| OLD | NEW |
| 1 From 0125566ec87741be89ba7c4e9c2e4cc3436a6122 Mon Sep 17 00:00:00 2001 | 1 From 0a5da8cd79a6b502edc01c40037ae418b2d5c828 Mon Sep 17 00:00:00 2001 |
| 2 From: dumi <dumi@chromium.org> | 2 From: dumi <dumi@chromium.org> |
| 3 Date: Mon, 20 Jul 2009 23:40:51 +0000 | 3 Date: Mon, 20 Jul 2009 23:40:51 +0000 |
| 4 Subject: [PATCH 05/12] Modify default VFS to support WebDatabase. | 4 Subject: [PATCH 04/10] Modify default VFS to support WebDatabase. |
| 5 | 5 |
| 6 The renderer WebDatabase implementation needs to broker certain requests | 6 The renderer WebDatabase implementation needs to broker certain requests |
| 7 to the browser. This modifies SQLite to allow monkey-patching the VFS | 7 to the browser. This modifies SQLite to allow monkey-patching the VFS |
| 8 to support this. | 8 to support this. |
| 9 | 9 |
| 10 NOTE(shess): This patch relies on core SQLite implementation details | 10 NOTE(shess): This patch relies on core SQLite implementation details |
| 11 remaining unchanged. When importing a new version of SQLite, pay very | 11 remaining unchanged. When importing a new version of SQLite, pay very |
| 12 close attention to whether the change is still doing what is intended. | 12 close attention to whether the change is still doing what is intended. |
| 13 | 13 |
| 14 Original review URLs: | 14 Original review URLs: |
| 15 https://codereview.chromium.org/159044 | 15 https://codereview.chromium.org/159044 |
| 16 https://codereview.chromium.org/384075 | 16 https://codereview.chromium.org/384075 |
| 17 https://codereview.chromium.org/377039 | 17 https://codereview.chromium.org/377039 |
| 18 [Possibly not a complete list.] | 18 [Possibly not a complete list.] |
| 19 --- | 19 --- |
| 20 third_party/sqlite/src/src/os_unix.c | 49 ++++++++++++++++++++++++++++++++++ | 20 third_party/sqlite/src/src/os_unix.c | 49 ++++++++++++++++++++++++++++++++++ |
| 21 third_party/sqlite/src/src/os_win.c | 8 ++++++ | 21 third_party/sqlite/src/src/os_win.c | 8 ++++++ |
| 22 third_party/sqlite/src/src/sqlite.h.in | 23 ++++++++++++++++ | 22 third_party/sqlite/src/src/sqlite.h.in | 23 ++++++++++++++++ |
| 23 3 files changed, 80 insertions(+) | 23 3 files changed, 80 insertions(+) |
| 24 | 24 |
| 25 diff --git a/third_party/sqlite/src/src/os_unix.c b/third_party/sqlite/src/src/o
s_unix.c | 25 diff --git a/third_party/sqlite/src/src/os_unix.c b/third_party/sqlite/src/src/o
s_unix.c |
| 26 index a9344ee..ea52abb 100644 | 26 index 791ba5d..fa85638 100644 |
| 27 --- a/third_party/sqlite/src/src/os_unix.c | 27 --- a/third_party/sqlite/src/src/os_unix.c |
| 28 +++ b/third_party/sqlite/src/src/os_unix.c | 28 +++ b/third_party/sqlite/src/src/os_unix.c |
| 29 @@ -1321,6 +1321,12 @@ static int fileHasMoved(unixFile *pFile){ | 29 @@ -1297,6 +1297,12 @@ static int fileHasMoved(unixFile *pFile){ |
| 30 return pFile->pInode!=0 && pFile->pId!=pFile->pInode->fileId.pId; | 30 return pFile->pInode!=0 && pFile->pId!=pFile->pInode->fileId.pId; |
| 31 #else | 31 #else |
| 32 struct stat buf; | 32 struct stat buf; |
| 33 + | 33 + |
| 34 + /* TODO(shess): This check doesn't work when the Chromium's WebDB code is | 34 + /* TODO(shess): This check doesn't work when the Chromium's WebDB code is |
| 35 + ** running in the sandbox. | 35 + ** running in the sandbox. |
| 36 + */ | 36 + */ |
| 37 + return 0; | 37 + return 0; |
| 38 + | 38 + |
| 39 return pFile->pInode!=0 && | 39 return pFile->pInode!=0 && |
| 40 (osStat(pFile->zPath, &buf)!=0 || buf.st_ino!=pFile->pInode->fileId.ino); | 40 (osStat(pFile->zPath, &buf)!=0 || buf.st_ino!=pFile->pInode->fileId.ino); |
| 41 #endif | 41 #endif |
| 42 @@ -5615,6 +5621,44 @@ static int findCreateFileMode( | 42 @@ -5554,6 +5560,44 @@ static int findCreateFileMode( |
| 43 } | 43 } |
| 44 | 44 |
| 45 /* | 45 /* |
| 46 +** Initialize |unixFile| internals of |file| on behalf of chromiumOpen() in | 46 +** Initialize |unixFile| internals of |file| on behalf of chromiumOpen() in |
| 47 +** WebDatabase SQLiteFileSystemPosix.cpp. Function is a subset of unixOpen(), | 47 +** WebDatabase SQLiteFileSystemPosix.cpp. Function is a subset of unixOpen(), |
| 48 +** each duplicated piece is marked by "Duplicated in" comment in unixOpen(). | 48 +** each duplicated piece is marked by "Duplicated in" comment in unixOpen(). |
| 49 +*/ | 49 +*/ |
| 50 +CHROMIUM_SQLITE_API | 50 +CHROMIUM_SQLITE_API |
| 51 +int chromium_sqlite3_fill_in_unix_sqlite3_file(sqlite3_vfs* pVfs, | 51 +int chromium_sqlite3_fill_in_unix_sqlite3_file(sqlite3_vfs* pVfs, |
| 52 + int fd, | 52 + int fd, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 77 + if( rc!=SQLITE_OK ){ | 77 + if( rc!=SQLITE_OK ){ |
| 78 + sqlite3_free(p->pUnused); | 78 + sqlite3_free(p->pUnused); |
| 79 + } | 79 + } |
| 80 + return rc; | 80 + return rc; |
| 81 +} | 81 +} |
| 82 + | 82 + |
| 83 +/* | 83 +/* |
| 84 ** Open the file zPath. | 84 ** Open the file zPath. |
| 85 ** | 85 ** |
| 86 ** Previously, the SQLite OS layer used three functions in place of this | 86 ** Previously, the SQLite OS layer used three functions in place of this |
| 87 @@ -5715,6 +5759,7 @@ static int unixOpen( | 87 @@ -5654,6 +5698,7 @@ static int unixOpen( |
| 88 sqlite3_randomness(0,0); | 88 sqlite3_randomness(0,0); |
| 89 } | 89 } |
| 90 | 90 |
| 91 + /* Duplicated in chromium_sqlite3_fill_in_unix_sqlite3_file(). */ | 91 + /* Duplicated in chromium_sqlite3_fill_in_unix_sqlite3_file(). */ |
| 92 memset(p, 0, sizeof(unixFile)); | 92 memset(p, 0, sizeof(unixFile)); |
| 93 | 93 |
| 94 if( eType==SQLITE_OPEN_MAIN_DB ){ | 94 if( eType==SQLITE_OPEN_MAIN_DB ){ |
| 95 @@ -5723,6 +5768,7 @@ static int unixOpen( | 95 @@ -5662,6 +5707,7 @@ static int unixOpen( |
| 96 if( pUnused ){ | 96 if( pUnused ){ |
| 97 fd = pUnused->fd; | 97 fd = pUnused->fd; |
| 98 }else{ | 98 }else{ |
| 99 + /* Duplicated in chromium_sqlite3_fill_in_unix_sqlite3_file(). */ | 99 + /* Duplicated in chromium_sqlite3_fill_in_unix_sqlite3_file(). */ |
| 100 pUnused = sqlite3_malloc(sizeof(*pUnused)); | 100 pUnused = sqlite3_malloc64(sizeof(*pUnused)); |
| 101 if( !pUnused ){ | 101 if( !pUnused ){ |
| 102 return SQLITE_NOMEM; | 102 return SQLITE_NOMEM; |
| 103 @@ -5799,6 +5845,7 @@ static int unixOpen( | 103 @@ -5739,6 +5785,7 @@ static int unixOpen( |
| 104 } | 104 } |
| 105 | 105 |
| 106 if( p->pUnused ){ | 106 if( p->pUnused ){ |
| 107 + /* Duplicated in chromium_sqlite3_fill_in_unix_sqlite3_file(). */ | 107 + /* Duplicated in chromium_sqlite3_fill_in_unix_sqlite3_file(). */ |
| 108 p->pUnused->fd = fd; | 108 p->pUnused->fd = fd; |
| 109 p->pUnused->flags = flags; | 109 p->pUnused->flags = flags; |
| 110 } | 110 } |
| 111 @@ -5889,10 +5936,12 @@ static int unixOpen( | 111 @@ -5819,10 +5866,12 @@ static int unixOpen( |
| 112 } | 112 } |
| 113 #endif | 113 #endif |
| 114 | 114 |
| 115 + /* Duplicated in chromium_sqlite3_fill_in_unix_sqlite3_file(). */ | 115 + /* Duplicated in chromium_sqlite3_fill_in_unix_sqlite3_file(). */ |
| 116 rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags); | 116 rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags); |
| 117 | 117 |
| 118 open_finished: | 118 open_finished: |
| 119 if( rc!=SQLITE_OK ){ | 119 if( rc!=SQLITE_OK ){ |
| 120 + /* Duplicated in chromium_sqlite3_fill_in_unix_sqlite3_file(). */ | 120 + /* Duplicated in chromium_sqlite3_fill_in_unix_sqlite3_file(). */ |
| 121 sqlite3_free(p->pUnused); | 121 sqlite3_free(p->pUnused); |
| 122 } | 122 } |
| 123 return rc; | 123 return rc; |
| 124 diff --git a/third_party/sqlite/src/src/os_win.c b/third_party/sqlite/src/src/os
_win.c | 124 diff --git a/third_party/sqlite/src/src/os_win.c b/third_party/sqlite/src/src/os
_win.c |
| 125 index 8ca2107..9320bfc 100644 | 125 index c54bfd6..00ad6fd 100644 |
| 126 --- a/third_party/sqlite/src/src/os_win.c | 126 --- a/third_party/sqlite/src/src/os_win.c |
| 127 +++ b/third_party/sqlite/src/src/os_win.c | 127 +++ b/third_party/sqlite/src/src/os_win.c |
| 128 @@ -5546,4 +5546,12 @@ int sqlite3_os_end(void){ | 128 @@ -5639,4 +5639,12 @@ int sqlite3_os_end(void){ |
| 129 return SQLITE_OK; | 129 return SQLITE_OK; |
| 130 } | 130 } |
| 131 | 131 |
| 132 +CHROMIUM_SQLITE_API | 132 +CHROMIUM_SQLITE_API |
| 133 +void chromium_sqlite3_initialize_win_sqlite3_file(sqlite3_file* file, HANDLE ha
ndle) { | 133 +void chromium_sqlite3_initialize_win_sqlite3_file(sqlite3_file* file, HANDLE ha
ndle) { |
| 134 + winFile* winSQLite3File = (winFile*)file; | 134 + winFile* winSQLite3File = (winFile*)file; |
| 135 + memset(file, 0, sizeof(*file)); | 135 + memset(file, 0, sizeof(*file)); |
| 136 + winSQLite3File->pMethod = &winIoMethod; | 136 + winSQLite3File->pMethod = &winIoMethod; |
| 137 + winSQLite3File->h = handle; | 137 + winSQLite3File->h = handle; |
| 138 +} | 138 +} |
| 139 + | 139 + |
| 140 #endif /* SQLITE_OS_WIN */ | 140 #endif /* SQLITE_OS_WIN */ |
| 141 diff --git a/third_party/sqlite/src/src/sqlite.h.in b/third_party/sqlite/src/src
/sqlite.h.in | 141 diff --git a/third_party/sqlite/src/src/sqlite.h.in b/third_party/sqlite/src/src
/sqlite.h.in |
| 142 index f1d4e40..14c12f2 100644 | 142 index 59b30cd..e5673fd 100644 |
| 143 --- a/third_party/sqlite/src/src/sqlite.h.in | 143 --- a/third_party/sqlite/src/src/sqlite.h.in |
| 144 +++ b/third_party/sqlite/src/src/sqlite.h.in | 144 +++ b/third_party/sqlite/src/src/sqlite.h.in |
| 145 @@ -7408,6 +7408,29 @@ int sqlite3_vtab_on_conflict(sqlite3 *); | 145 @@ -7411,6 +7411,29 @@ int sqlite3_strnicmp(const char *, const char *, int); |
| 146 | 146 */ |
| 147 | 147 int sqlite3_strglob(const char *zGlob, const char *zStr); |
| 148 | 148 |
| 149 +/* Begin WebDatabase patch for Chromium */ | 149 +/* Begin WebDatabase patch for Chromium */ |
| 150 +/* Expose some SQLite internals for the WebDatabase vfs. | 150 +/* Expose some SQLite internals for the WebDatabase vfs. |
| 151 +** DO NOT EXTEND THE USE OF THIS. | 151 +** DO NOT EXTEND THE USE OF THIS. |
| 152 +*/ | 152 +*/ |
| 153 +#ifndef CHROMIUM_SQLITE_API | 153 +#ifndef CHROMIUM_SQLITE_API |
| 154 +#define CHROMIUM_SQLITE_API SQLITE_API | 154 +#define CHROMIUM_SQLITE_API SQLITE_API |
| 155 +#endif | 155 +#endif |
| 156 +#if defined(CHROMIUM_SQLITE_INTERNALS) | 156 +#if defined(CHROMIUM_SQLITE_INTERNALS) |
| 157 +#ifdef _WIN32 | 157 +#ifdef _WIN32 |
| 158 +CHROMIUM_SQLITE_API | 158 +CHROMIUM_SQLITE_API |
| 159 +void chromium_sqlite3_initialize_win_sqlite3_file(sqlite3_file* file, HANDLE ha
ndle); | 159 +void chromium_sqlite3_initialize_win_sqlite3_file(sqlite3_file* file, HANDLE ha
ndle); |
| 160 +#else /* _WIN32 */ | 160 +#else /* _WIN32 */ |
| 161 +CHROMIUM_SQLITE_API | 161 +CHROMIUM_SQLITE_API |
| 162 +int chromium_sqlite3_fill_in_unix_sqlite3_file(sqlite3_vfs* pVfs, | 162 +int chromium_sqlite3_fill_in_unix_sqlite3_file(sqlite3_vfs* pVfs, |
| 163 + int fd, | 163 + int fd, |
| 164 + sqlite3_file* pFile, | 164 + sqlite3_file* pFile, |
| 165 + const char* zPath, | 165 + const char* zPath, |
| 166 + int noLock, | 166 + int noLock, |
| 167 + int flags); | 167 + int flags); |
| 168 +#endif /* _WIN32 */ | 168 +#endif /* _WIN32 */ |
| 169 +#endif /* CHROMIUM_SQLITE_INTERNALS */ | 169 +#endif /* CHROMIUM_SQLITE_INTERNALS */ |
| 170 +/* End WebDatabase patch for Chromium */ | 170 +/* End WebDatabase patch for Chromium */ |
| 171 + | 171 + |
| 172 /* | 172 /* |
| 173 ** Undo the hack that converts floating point types to integer for | 173 ** CAPI3REF: String LIKE Matching |
| 174 ** builds on processors without floating point support. | 174 * |
| 175 -- | 175 -- |
| 176 2.6.3 | 176 2.7.0 |
| 177 | 177 |
| OLD | NEW |