build: Upgrade //third_party/sqlite from 3.20.0 to 3.26.0 (#733)
Backports https://chromium-review.googlesource.com/c/chromium/src/+/1352694
This commit is contained in:
Родитель
e90608c237
Коммит
0cc7c93746
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,218 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Thu, 13 Dec 2018 04:13:40 +0530
|
||||
Subject: sqlite: Update api in //sql and //third_party/WebKit
|
||||
|
||||
Refs https://chromium-review.googlesource.com/c/chromium/src/+/1352694
|
||||
|
||||
diff --git a/content/browser/dom_storage/dom_storage_database.cc b/content/browser/dom_storage/dom_storage_database.cc
|
||||
index 2f47c3af03e5262bf6a2588fc1b05b7b1ec604d1..2bfc5fc3a2108001e43702c24cdb20dd5b033320 100644
|
||||
--- a/content/browser/dom_storage/dom_storage_database.cc
|
||||
+++ b/content/browser/dom_storage/dom_storage_database.cc
|
||||
@@ -200,12 +200,8 @@ bool DOMStorageDatabase::LazyOpen(bool create_if_needed) {
|
||||
// and whether it's usable (i.e. not corrupted).
|
||||
SchemaVersion current_version = DetectSchemaVersion();
|
||||
|
||||
- if (current_version == V2) {
|
||||
+ if (current_version == V2)
|
||||
return true;
|
||||
- } else if (current_version == V1) {
|
||||
- if (UpgradeVersion1To2())
|
||||
- return true;
|
||||
- }
|
||||
}
|
||||
|
||||
// This is the exceptional case - to try and recover we'll attempt
|
||||
@@ -232,20 +228,7 @@ DOMStorageDatabase::SchemaVersion DOMStorageDatabase::DetectSchemaVersion() {
|
||||
!db_->DoesColumnExist("ItemTable", "value"))
|
||||
return INVALID;
|
||||
|
||||
- // We must use a unique statement here as we aren't going to step it.
|
||||
- sql::Statement statement(
|
||||
- db_->GetUniqueStatement("SELECT key,value from ItemTable LIMIT 1"));
|
||||
- if (statement.DeclaredColumnType(0) != sql::COLUMN_TYPE_TEXT)
|
||||
- return INVALID;
|
||||
-
|
||||
- switch (statement.DeclaredColumnType(1)) {
|
||||
- case sql::COLUMN_TYPE_BLOB:
|
||||
- return V2;
|
||||
- case sql::COLUMN_TYPE_TEXT:
|
||||
- return V1;
|
||||
- default:
|
||||
- return INVALID;
|
||||
- }
|
||||
+ return V2;
|
||||
}
|
||||
|
||||
bool DOMStorageDatabase::CreateTableV2() {
|
||||
@@ -277,32 +260,6 @@ bool DOMStorageDatabase::DeleteFileAndRecreate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
-bool DOMStorageDatabase::UpgradeVersion1To2() {
|
||||
- DCHECK(IsOpen());
|
||||
- DCHECK(DetectSchemaVersion() == V1);
|
||||
-
|
||||
- sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE,
|
||||
- "SELECT * FROM ItemTable"));
|
||||
- DCHECK(statement.is_valid());
|
||||
-
|
||||
- // Need to migrate from TEXT value column to BLOB.
|
||||
- // Store the current database content so we can re-insert
|
||||
- // the data into the new V2 table.
|
||||
- DOMStorageValuesMap values;
|
||||
- while (statement.Step()) {
|
||||
- base::string16 key = statement.ColumnString16(0);
|
||||
- base::NullableString16 value(statement.ColumnString16(1), false);
|
||||
- values[key] = value;
|
||||
- }
|
||||
-
|
||||
- sql::Transaction migration(db_.get());
|
||||
- return migration.Begin() &&
|
||||
- db_->Execute("DROP TABLE ItemTable") &&
|
||||
- CreateTableV2() &&
|
||||
- CommitChanges(false, values) &&
|
||||
- migration.Commit();
|
||||
-}
|
||||
-
|
||||
void DOMStorageDatabase::Close() {
|
||||
db_.reset(NULL);
|
||||
}
|
||||
diff --git a/content/browser/dom_storage/dom_storage_database.h b/content/browser/dom_storage/dom_storage_database.h
|
||||
index 9f5fd4a61be6e8426e0857e0f7c1b5a3d5324810..bcf8a3ba713989f51eaa191acc30103c8cef57fe 100644
|
||||
--- a/content/browser/dom_storage/dom_storage_database.h
|
||||
+++ b/content/browser/dom_storage/dom_storage_database.h
|
||||
@@ -80,8 +80,10 @@ class CONTENT_EXPORT DOMStorageDatabase {
|
||||
|
||||
enum SchemaVersion {
|
||||
INVALID,
|
||||
- V1,
|
||||
- V2
|
||||
+ // V1 is deprecated.
|
||||
+
|
||||
+ // 2011-07-15 - https://bugs.webkit.org/show_bug.cgi?id=58762
|
||||
+ V2,
|
||||
};
|
||||
|
||||
// Open the database at file_path_ if it exists already and creates it if
|
||||
@@ -105,12 +107,6 @@ class CONTENT_EXPORT DOMStorageDatabase {
|
||||
// scratch.
|
||||
bool DeleteFileAndRecreate();
|
||||
|
||||
- // Version 1 -> 2 migrates the value column in the ItemTable from a TEXT
|
||||
- // to a BLOB. Exisitng data is preserved on success. Returns false if the
|
||||
- // upgrade failed. If true is returned, the database is guaranteed to be at
|
||||
- // version 2.
|
||||
- bool UpgradeVersion1To2();
|
||||
-
|
||||
void Close();
|
||||
bool IsOpen() const { return db_.get() ? db_->is_open() : false; }
|
||||
|
||||
diff --git a/sql/connection.cc b/sql/connection.cc
|
||||
index d7477f57dbfca926fb8c8c78c63cb02a810e5c05..42b051da326d64d2f9fc920975a2831692ad7afe 100644
|
||||
--- a/sql/connection.cc
|
||||
+++ b/sql/connection.cc
|
||||
@@ -1705,9 +1705,17 @@ bool Connection::OpenInternal(const std::string& file_name,
|
||||
// Custom memory-mapping VFS which reads pages using regular I/O on first hit.
|
||||
sqlite3_vfs* vfs = VFSWrapper();
|
||||
const char* vfs_name = (vfs ? vfs->zName : nullptr);
|
||||
- int err = sqlite3_open_v2(file_name.c_str(), &db_,
|
||||
- SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
|
||||
- vfs_name);
|
||||
+
|
||||
+ // The flags are documented at https://www.sqlite.org/c3ref/open.html.
|
||||
+ //
|
||||
+ // Chrome uses SQLITE_OPEN_PRIVATECACHE because SQLite is used by many
|
||||
+ // disparate features with their own databases, and having separate page
|
||||
+ // caches makes it easier to reason about each feature's performance in
|
||||
+ // isolation.
|
||||
+ int err = sqlite3_open_v2(
|
||||
+ file_name.c_str(), &db_,
|
||||
+ SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_PRIVATECACHE,
|
||||
+ vfs_name);
|
||||
if (err != SQLITE_OK) {
|
||||
// Extended error codes cannot be enabled until a handle is
|
||||
// available, fetch manually.
|
||||
diff --git a/sql/recovery.cc b/sql/recovery.cc
|
||||
index 64eefa51104efcced21f8caa0ab03a7da92d256a..0fac334df866ac10b8130764602b2ef193b37d3d 100644
|
||||
--- a/sql/recovery.cc
|
||||
+++ b/sql/recovery.cc
|
||||
@@ -244,7 +244,7 @@ bool Recovery::Init(const base::FilePath& db_path) {
|
||||
}
|
||||
|
||||
// Enable the recover virtual table for this connection.
|
||||
- int rc = recoverVtableInit(recover_db_.db_);
|
||||
+ int rc = chrome_sqlite3_recoverVtableInit(recover_db_.db_);
|
||||
if (rc != SQLITE_OK) {
|
||||
RecordRecoveryEvent(RECOVERY_FAILED_VIRTUAL_TABLE_INIT);
|
||||
LOG(ERROR) << "Failed to initialize recover module: "
|
||||
diff --git a/sql/statement.cc b/sql/statement.cc
|
||||
index 5778fd0d7daf930b06698e2c632a985e4d254148..a56534526de0be2e5143b0ed25784dbfdd8fc222 100644
|
||||
--- a/sql/statement.cc
|
||||
+++ b/sql/statement.cc
|
||||
@@ -217,22 +217,6 @@ ColType Statement::ColumnType(int col) const {
|
||||
return static_cast<ColType>(sqlite3_column_type(ref_->stmt(), col));
|
||||
}
|
||||
|
||||
-ColType Statement::DeclaredColumnType(int col) const {
|
||||
- std::string column_type = base::ToLowerASCII(
|
||||
- sqlite3_column_decltype(ref_->stmt(), col));
|
||||
-
|
||||
- if (column_type == "integer")
|
||||
- return COLUMN_TYPE_INTEGER;
|
||||
- else if (column_type == "float")
|
||||
- return COLUMN_TYPE_FLOAT;
|
||||
- else if (column_type == "text")
|
||||
- return COLUMN_TYPE_TEXT;
|
||||
- else if (column_type == "blob")
|
||||
- return COLUMN_TYPE_BLOB;
|
||||
-
|
||||
- return COLUMN_TYPE_NULL;
|
||||
-}
|
||||
-
|
||||
bool Statement::ColumnBool(int col) const {
|
||||
return !!ColumnInt(col);
|
||||
}
|
||||
diff --git a/sql/statement.h b/sql/statement.h
|
||||
index 3bc99ed2924b1756e7359e4be29f0702b1dac962..115895b8501992cc8ca4bd66281e0e5ad7ba28e0 100644
|
||||
--- a/sql/statement.h
|
||||
+++ b/sql/statement.h
|
||||
@@ -124,7 +124,6 @@ class SQL_EXPORT Statement {
|
||||
// where that type is not the native type. For safety, call ColumnType only
|
||||
// on a column before getting the value out in any way.
|
||||
ColType ColumnType(int col) const;
|
||||
- ColType DeclaredColumnType(int col) const;
|
||||
|
||||
// These all take a 0-based argument index.
|
||||
bool ColumnBool(int col) const;
|
||||
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseAuthorizer.cpp b/third_party/WebKit/Source/modules/webdatabase/DatabaseAuthorizer.cpp
|
||||
index f9e5d18cc9c0b59a8c1d8488f340a5de2a539569..f2f0b3e2cdc51f3f86d30ce9159acc89198e8881 100644
|
||||
--- a/third_party/WebKit/Source/modules/webdatabase/DatabaseAuthorizer.cpp
|
||||
+++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseAuthorizer.cpp
|
||||
@@ -72,7 +72,7 @@ const FunctionNameList& WhitelistedFunctions() {
|
||||
({
|
||||
// SQLite functions used to help implement some operations
|
||||
// ALTER TABLE helpers
|
||||
- "sqlite_rename_table", "sqlite_rename_trigger",
|
||||
+ "sqlite_rename_column", "sqlite_rename_table", "sqlite_rename_test",
|
||||
// GLOB helpers
|
||||
"glob",
|
||||
// SQLite core functions
|
||||
diff --git a/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteFileSystem.cpp b/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteFileSystem.cpp
|
||||
index fa7d9daadd0739b6ea11189b238dbc6c59f59287..fc233a1205a0611ed017cdb615fc5e01a90b40d9 100644
|
||||
--- a/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteFileSystem.cpp
|
||||
+++ b/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteFileSystem.cpp
|
||||
@@ -42,9 +42,10 @@ namespace blink {
|
||||
SQLiteFileSystem::SQLiteFileSystem() {}
|
||||
|
||||
int SQLiteFileSystem::OpenDatabase(const String& filename, sqlite3** database) {
|
||||
- return sqlite3_open_v2(filename.Utf8().data(), database,
|
||||
- SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
|
||||
- "chromium_vfs");
|
||||
+ return sqlite3_open_v2(
|
||||
+ filename.Utf8().data(), database,
|
||||
+ SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_PRIVATECACHE,
|
||||
+ "chromium_vfs");
|
||||
}
|
||||
|
||||
} // namespace blink
|
Загрузка…
Ссылка в новой задаче