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

Unified Diff: third_party/sqlite/patches/0006-Modify-default-VFS-to-support-WebDatabase.patch

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 months 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
Index: third_party/sqlite/patches/0006-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/0006-Modify-default-VFS-to-support-WebDatabase.patch
deleted file mode 100644
index 4d2093307abff4334869b16b12c968d9d1a16c4b..0000000000000000000000000000000000000000
--- a/third_party/sqlite/patches/0006-Modify-default-VFS-to-support-WebDatabase.patch
+++ /dev/null
@@ -1,184 +0,0 @@
-From 25f1f784320aa0e32b69f78098b652b30df40865 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.
-
-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 | 98 +++++++++++++++++++++++++++++-------
- third_party/sqlite/src/src/os_win.c | 7 +++
- 2 files changed, 88 insertions(+), 17 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
---- 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));
-+}
-+
-+/*
- ** 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(
- }
-
- /*
-+** Initializes a unixFile structure with zeros.
-+*/
-+void chromium_sqlite3_initialize_unix_sqlite3_file(sqlite3_file* file) {
-+ memset(file, 0, sizeof(unixFile));
-+}
-+
-+int chromium_sqlite3_fill_in_unix_sqlite3_file(sqlite3_vfs* vfs,
-+ int fd,
-+ int dirfd,
-+ sqlite3_file* file,
-+ const char* fileName,
-+ int noLock,
-+ int isDelete) {
-+ return fillInUnixFile(vfs, fd, dirfd, file, fileName, noLock, isDelete, 0);
-+}
-+
-+/*
-+** Search for an unused file descriptor that was opened on the database file.
-+** If a suitable file descriptor if found, then it is stored in *fd; otherwise,
-+** *fd is not modified.
-+**
-+** If a reusable file descriptor is not found, and a new UnixUnusedFd cannot
-+** be allocated, SQLITE_NOMEM is returned. Otherwise, SQLITE_OK is returned.
-+*/
-+int chromium_sqlite3_get_reusable_file_handle(sqlite3_file* file,
-+ const char* fileName,
-+ int flags,
-+ int* fd) {
-+ unixFile* unixSQLite3File = (unixFile*)file;
-+ int fileType = flags & 0xFFFFFF00;
-+ if (fileType == SQLITE_OPEN_MAIN_DB) {
-+ UnixUnusedFd *unusedFd = findReusableFd(fileName, flags);
-+ if (unusedFd) {
-+ *fd = unusedFd->fd;
-+ } else {
-+ unusedFd = sqlite3_malloc(sizeof(*unusedFd));
-+ if (!unusedFd) {
-+ return SQLITE_NOMEM;
-+ }
-+ }
-+ unixSQLite3File->pUnused = unusedFd;
-+ }
-+ return SQLITE_OK;
-+}
-+
-+/*
-+** Marks 'fd' as the unused file descriptor for 'pFile'.
-+*/
-+void chromium_sqlite3_update_reusable_file_handle(sqlite3_file* file,
-+ int fd,
-+ int flags) {
-+ unixFile* unixSQLite3File = (unixFile*)file;
-+ if (unixSQLite3File->pUnused) {
-+ unixSQLite3File->pUnused->fd = fd;
-+ unixSQLite3File->pUnused->flags = flags;
-+ }
-+}
-+
-+/*
-+** Destroys pFile's field that keeps track of the unused file descriptor.
-+*/
-+void chromium_sqlite3_destroy_reusable_file_handle(sqlite3_file* file) {
-+ unixFile* unixSQLite3File = (unixFile*)file;
-+ sqlite3_free(unixSQLite3File->pUnused);
-+}
-+
-+/*
- ** 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
- );
-
-- memset(p, 0, sizeof(unixFile));
-+ chromium_sqlite3_initialize_unix_sqlite3_file(pFile);
-
- if( eType==SQLITE_OPEN_MAIN_DB ){
-- UnixUnusedFd *pUnused;
-- pUnused = findReusableFd(zName, flags);
-- if( pUnused ){
-- fd = pUnused->fd;
-- }else{
-- pUnused = sqlite3_malloc(sizeof(*pUnused));
-- if( !pUnused ){
-- return SQLITE_NOMEM;
-- }
-+ rc = chromium_sqlite3_get_reusable_file_handle(pFile, zName, flags, &fd);
-+ if( rc!=SQLITE_OK ){
-+ 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(
- *pOutFlags = flags;
- }
-
-- if( p->pUnused ){
-- p->pUnused->fd = fd;
-- p->pUnused->flags = flags;
-- }
-+ chromium_sqlite3_update_reusable_file_handle(pFile, fd, flags);
-
- if( isDelete ){
- #if OS_VXWORKS
-@@ -5090,7 +5154,7 @@ static int unixOpen(
- isDelete, isReadonly);
- open_finished:
- if( rc!=SQLITE_OK ){
-- sqlite3_free(p->pUnused);
-+ chromium_sqlite3_destroy_reusable_file_handle(pFile);
- }
- 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
---- 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){
- return SQLITE_OK;
- }
-
-+void chromium_sqlite3_initialize_win_sqlite3_file(sqlite3_file* file, HANDLE handle) {
-+ winFile* winSQLite3File = (winFile*)file;
-+ memset(file, 0, sizeof(*file));
-+ winSQLite3File->pMethod = &winIoMethod;
-+ winSQLite3File->h = handle;
-+}
-+
- #endif /* SQLITE_OS_WIN */
---
-2.2.1
-

Powered by Google App Engine
This is Rietveld 408576698