Changeset 280415 in webkit
- Timestamp:
- Jul 28, 2021 9:04:18 PM (12 months ago)
- Location:
- trunk
- Files:
-
- 7 added
- 25 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idlharness.any-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idlharness.any.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/transaction-relaxed-durability.tentative.any-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/transaction-relaxed-durability.tentative.any.worker-expected.txt (modified) (1 diff)
-
LayoutTests/storage/indexeddb/idbtransaction-durability-expected.txt (added)
-
LayoutTests/storage/indexeddb/idbtransaction-durability-private-expected.txt (added)
-
LayoutTests/storage/indexeddb/idbtransaction-durability-private.html (added)
-
LayoutTests/storage/indexeddb/idbtransaction-durability.html (added)
-
LayoutTests/storage/indexeddb/resources/idbtransaction-durability.js (added)
-
Source/WebCore/CMakeLists.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/DerivedSources-input.xcfilelist (modified) (1 diff)
-
Source/WebCore/DerivedSources-output.xcfilelist (modified) (1 diff)
-
Source/WebCore/DerivedSources.make (modified) (1 diff)
-
Source/WebCore/Headers.cmake (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/IDBDatabase.cpp (modified) (2 diffs)
-
Source/WebCore/Modules/indexeddb/IDBDatabase.h (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/IDBDatabase.idl (modified) (2 diffs)
-
Source/WebCore/Modules/indexeddb/IDBTransaction.h (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/IDBTransaction.idl (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/IDBTransactionDurability.h (added)
-
Source/WebCore/Modules/indexeddb/IDBTransactionDurability.idl (added)
-
Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.h (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp (modified) (3 diffs)
-
Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h (modified) (6 diffs)
-
Source/WebCore/Sources.txt (modified) (1 diff)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (4 diffs)
-
Source/WebCore/platform/sql/SQLiteDatabase.cpp (modified) (2 diffs)
-
Source/WebCore/platform/sql/SQLiteDatabase.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r280411 r280415 1 2021-07-28 Sihui Liu <sihui_liu@apple.com> 2 3 Implement IDBTransaction.durability 4 https://bugs.webkit.org/show_bug.cgi?id=228289 5 6 Reviewed by Darin Adler. 7 8 * storage/indexeddb/idbtransaction-durability-expected.txt: Added. 9 * storage/indexeddb/idbtransaction-durability-private-expected.txt: Added. 10 * storage/indexeddb/idbtransaction-durability-private.html: Added. 11 * storage/indexeddb/idbtransaction-durability.html: Added. 12 * storage/indexeddb/resources/idbtransaction-durability.js: Added. 13 (onOpenUpgradeNeeded): 14 (onOpenSuccess): 15 (onTransactionComplete): 16 1 17 2021-07-28 Ayumi Kojima <ayumi_kojima@apple.com> 2 18 -
trunk/LayoutTests/imported/w3c/ChangeLog
r280410 r280415 1 2021-07-28 Sihui Liu <sihui_liu@apple.com> 2 3 Implement IDBTransaction.durability 4 https://bugs.webkit.org/show_bug.cgi?id=228289 5 6 Reviewed by Darin Adler. 7 8 * web-platform-tests/IndexedDB/idlharness.any-expected.txt: 9 * web-platform-tests/IndexedDB/idlharness.any.worker-expected.txt: 10 * web-platform-tests/IndexedDB/transaction-relaxed-durability.tentative.any-expected.txt: 11 * web-platform-tests/IndexedDB/transaction-relaxed-durability.tentative.any.worker-expected.txt: 12 1 13 2021-07-28 Sihui Liu <sihui_liu@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idlharness.any-expected.txt
r280053 r280415 186 186 PASS IDBTransaction interface: attribute objectStoreNames 187 187 PASS IDBTransaction interface: attribute mode 188 FAIL IDBTransaction interface: attribute durability assert_true: The prototype object must have a property "durability" expected true got false 188 PASS IDBTransaction interface: attribute durability 189 189 PASS IDBTransaction interface: attribute db 190 190 PASS IDBTransaction interface: attribute error -
trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idlharness.any.worker-expected.txt
r280053 r280415 186 186 PASS IDBTransaction interface: attribute objectStoreNames 187 187 PASS IDBTransaction interface: attribute mode 188 FAIL IDBTransaction interface: attribute durability assert_true: The prototype object must have a property "durability" expected true got false 188 PASS IDBTransaction interface: attribute durability 189 189 PASS IDBTransaction interface: attribute db 190 190 PASS IDBTransaction interface: attribute error -
trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/transaction-relaxed-durability.tentative.any-expected.txt
r263437 r280415 1 1 2 FAIL Committed data can be read back out: case 0 assert_equals: expected (string) "default" but got (undefined) undefined 3 FAIL Committed data can be read back out: case 1 assert_equals: expected (string) "default" but got (undefined) undefined 4 FAIL Committed data can be read back out: case 2 assert_equals: expected (string) "default" but got (undefined) undefined 5 FAIL Committed data can be read back out: case 3 assert_equals: expected (string) "relaxed" but got (undefined) undefined 6 FAIL Committed data can be read back out: case 4 assert_equals: expected (string) "strict" but got (undefined) undefined 7 FAIL Invalid durability option throws a TypeError assert_throws_js: function "function () { 8 db.transaction(['books'], 'readwrite', { durability: 'invalid' }); 9 }" did not throw 2 PASS Committed data can be read back out: case 0 3 PASS Committed data can be read back out: case 1 4 PASS Committed data can be read back out: case 2 5 PASS Committed data can be read back out: case 3 6 PASS Committed data can be read back out: case 4 7 PASS Invalid durability option throws a TypeError 10 8 -
trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/transaction-relaxed-durability.tentative.any.worker-expected.txt
r263437 r280415 1 1 2 FAIL Committed data can be read back out: case 0 assert_equals: expected (string) "default" but got (undefined) undefined 3 FAIL Committed data can be read back out: case 1 assert_equals: expected (string) "default" but got (undefined) undefined 4 FAIL Committed data can be read back out: case 2 assert_equals: expected (string) "default" but got (undefined) undefined 5 FAIL Committed data can be read back out: case 3 assert_equals: expected (string) "relaxed" but got (undefined) undefined 6 FAIL Committed data can be read back out: case 4 assert_equals: expected (string) "strict" but got (undefined) undefined 7 FAIL Invalid durability option throws a TypeError assert_throws_js: function "function () { 8 db.transaction(['books'], 'readwrite', { durability: 'invalid' }); 9 }" did not throw 2 PASS Committed data can be read back out: case 0 3 PASS Committed data can be read back out: case 1 4 PASS Committed data can be read back out: case 2 5 PASS Committed data can be read back out: case 3 6 PASS Committed data can be read back out: case 4 7 PASS Invalid durability option throws a TypeError 10 8 -
trunk/Source/WebCore/CMakeLists.txt
r280310 r280415 304 304 Modules/indexeddb/IDBRequest.idl 305 305 Modules/indexeddb/IDBTransaction.idl 306 Modules/indexeddb/IDBTransactionDurability.idl 306 307 Modules/indexeddb/IDBTransactionMode.idl 307 308 Modules/indexeddb/IDBVersionChangeEvent.idl -
trunk/Source/WebCore/ChangeLog
r280410 r280415 1 2021-07-28 Sihui Liu <sihui_liu@apple.com> 2 3 Implement IDBTransaction.durability 4 https://bugs.webkit.org/show_bug.cgi?id=228289 5 6 Reviewed by Darin Adler. 7 8 Spec: https://www.w3.org/TR/IndexedDB/#dom-idbtransaction-durability 9 https://www.w3.org/TR/IndexedDB/#dictdef-idbtransactionoptions 10 11 IDBTransaction.durability gives a hint about durability of a transaction. If it's strict, backend would try 12 syncing data to database file after transaction commit, which enforces durability. If it's relaxed, it means 13 data may stay in the OS buffer some time after transaction commit, which gives better performance. Firefox and 14 Chrome already implemented durability. They have different ways of setting durability, and we choose to use 15 TransactionOptions as spec. 16 17 Rebaselined existing tests. 18 New tests: storage/indexeddb/idbtransaction-durability-private.html 19 storage/indexeddb/idbtransaction-durability.html 20 21 * CMakeLists.txt: 22 * DerivedSources-input.xcfilelist: 23 * DerivedSources-output.xcfilelist: 24 * DerivedSources.make: 25 * Headers.cmake: 26 * Modules/indexeddb/IDBDatabase.cpp: 27 (WebCore::IDBDatabase::transaction): 28 * Modules/indexeddb/IDBDatabase.h: 29 * Modules/indexeddb/IDBDatabase.idl: 30 * Modules/indexeddb/IDBTransaction.h: 31 * Modules/indexeddb/IDBTransaction.idl: 32 * Modules/indexeddb/IDBTransactionDurability.h: Added. 33 * Modules/indexeddb/IDBTransactionDurability.idl: Added. 34 * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: 35 (WebCore::IDBServer::SQLiteIDBBackingStore::commitTransaction): 36 * Modules/indexeddb/server/SQLiteIDBTransaction.h: 37 (WebCore::IDBServer::SQLiteIDBTransaction::durability const): 38 * Modules/indexeddb/shared/IDBTransactionInfo.cpp: 39 (WebCore::IDBTransactionInfo::clientTransaction): 40 (WebCore::IDBTransactionInfo::IDBTransactionInfo): 41 (WebCore::IDBTransactionInfo::isolatedCopy): 42 * Modules/indexeddb/shared/IDBTransactionInfo.h: 43 (WebCore::IDBTransactionInfo::durability const): 44 (WebCore::IDBTransactionInfo::encode const): 45 (WebCore::IDBTransactionInfo::decode): 46 * Sources.txt: 47 * WebCore.xcodeproj/project.pbxproj: 48 * platform/sql/SQLiteDatabase.cpp: 49 (WebCore::checkpointModeValue): 50 (WebCore::SQLiteDatabase::checkpoint): 51 (WebCore::SQLiteDatabase::useWALJournalMode): 52 * platform/sql/SQLiteDatabase.h: 53 1 54 2021-07-28 Sihui Liu <sihui_liu@apple.com> 2 55 -
trunk/Source/WebCore/DerivedSources-input.xcfilelist
r280310 r280415 152 152 $(PROJECT_DIR)/Modules/indexeddb/IDBRequest.idl 153 153 $(PROJECT_DIR)/Modules/indexeddb/IDBTransaction.idl 154 $(PROJECT_DIR)/Modules/indexeddb/IDBTransactionDurability.idl 154 155 $(PROJECT_DIR)/Modules/indexeddb/IDBTransactionMode.idl 155 156 $(PROJECT_DIR)/Modules/indexeddb/IDBVersionChangeEvent.idl -
trunk/Source/WebCore/DerivedSources-output.xcfilelist
r280310 r280415 1168 1168 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIDBTransaction.cpp 1169 1169 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIDBTransaction.h 1170 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIDBTransactionDurability.cpp 1171 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIDBTransactionDurability.h 1170 1172 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIDBTransactionMode.cpp 1171 1173 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIDBTransactionMode.h -
trunk/Source/WebCore/DerivedSources.make
r280310 r280415 178 178 $(WebCore)/Modules/indexeddb/IDBRequest.idl \ 179 179 $(WebCore)/Modules/indexeddb/IDBTransaction.idl \ 180 $(WebCore)/Modules/indexeddb/IDBTransactionDurability.idl \ 180 181 $(WebCore)/Modules/indexeddb/IDBTransactionMode.idl \ 181 182 $(WebCore)/Modules/indexeddb/IDBVersionChangeEvent.idl \ -
trunk/Source/WebCore/Headers.cmake
r279971 r280415 67 67 Modules/indexeddb/IDBRequest.h 68 68 Modules/indexeddb/IDBTransaction.h 69 Modules/indexeddb/IDBTransactionDurability.h 69 70 Modules/indexeddb/IDBTransactionMode.h 70 71 Modules/indexeddb/IDBValue.h -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
r280053 r280415 163 163 } 164 164 165 ExceptionOr<Ref<IDBTransaction>> IDBDatabase::transaction(StringOrVectorOfStrings&& storeNames, IDBTransactionMode mode )165 ExceptionOr<Ref<IDBTransaction>> IDBDatabase::transaction(StringOrVectorOfStrings&& storeNames, IDBTransactionMode mode, TransactionOptions options) 166 166 { 167 167 LOG(IndexedDB, "IDBDatabase::transaction"); … … 201 201 return Exception { TypeError }; 202 202 203 auto info = IDBTransactionInfo::clientTransaction(m_connectionProxy.get(), objectStores, mode );203 auto info = IDBTransactionInfo::clientTransaction(m_connectionProxy.get(), objectStores, mode, options.durability); 204 204 205 205 LOG(IndexedDBOperations, "IDB creating transaction: %s", info.loggingString().utf8().data()); -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h
r278253 r280415 64 64 65 65 using StringOrVectorOfStrings = WTF::Variant<String, Vector<String>>; 66 ExceptionOr<Ref<IDBTransaction>> transaction(StringOrVectorOfStrings&& storeNames, IDBTransactionMode); 66 struct TransactionOptions { 67 std::optional<IDBTransactionDurability> durability; 68 }; 69 ExceptionOr<Ref<IDBTransaction>> transaction(StringOrVectorOfStrings&& storeNames, IDBTransactionMode, TransactionOptions = { }); 67 70 ExceptionOr<void> deleteObjectStore(const String& name); 68 71 void close(); -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl
r275151 r280415 34 34 readonly attribute DOMStringList objectStoreNames; 35 35 36 // FIXME: 'transaction' should also take an optional 'IDBTransactionOptions' argument. 37 [NewObject] IDBTransaction transaction((DOMString or sequence<DOMString>) storeNames, optional IDBTransactionMode mode = "readonly"); 36 [NewObject] IDBTransaction transaction((DOMString or sequence<DOMString>) storeNames, optional IDBTransactionMode mode = "readonly", optional IDBTransactionOptions options); 38 37 undefined close(); 39 38 … … 56 55 boolean autoIncrement = false; 57 56 }; 57 58 dictionary IDBTransactionOptions { 59 IDBTransactionDurability durability = "default"; 60 }; -
trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h
r280053 r280415 78 78 Ref<DOMStringList> objectStoreNames() const; 79 79 IDBTransactionMode mode() const { return m_info.mode(); } 80 IDBTransactionDurability durability() const { return m_info.durability(); } 80 81 IDBDatabase* db(); 81 82 DOMException* error() const; -
trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl
r280053 r280415 33 33 readonly attribute DOMStringList objectStoreNames; 34 34 readonly attribute IDBTransactionMode mode; 35 // Implement 'durability'. 36 // readonly attribute IDBTransactionDurability durability; 35 readonly attribute IDBTransactionDurability durability; 37 36 [SameObject] readonly attribute IDBDatabase db; 38 37 readonly attribute DOMException? error; -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
r279237 r280415 1150 1150 m_databaseInfo = WTFMove(m_originalDatabaseInfoBeforeVersionChange); 1151 1151 } 1152 } else 1152 } else { 1153 1153 m_originalDatabaseInfoBeforeVersionChange = nullptr; 1154 if (transaction->durability() == IDBTransactionDurability::Strict) 1155 m_sqliteDB->checkpoint(SQLiteDatabase::CheckpointMode::Full); 1156 } 1154 1157 1155 1158 return error; -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.h
r275151 r280415 66 66 67 67 IDBTransactionMode mode() const { return m_info.mode(); } 68 IDBTransactionDurability durability() const { return m_info.durability(); } 68 69 bool inProgress() const; 69 70 -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp
r275151 r280415 40 40 } 41 41 42 IDBTransactionInfo IDBTransactionInfo::clientTransaction(const IDBClient::IDBConnectionProxy& connectionProxy, const Vector<String>& objectStores, IDBTransactionMode mode )42 IDBTransactionInfo IDBTransactionInfo::clientTransaction(const IDBClient::IDBConnectionProxy& connectionProxy, const Vector<String>& objectStores, IDBTransactionMode mode, std::optional<IDBTransactionDurability> durability) 43 43 { 44 44 IDBTransactionInfo result((IDBResourceIdentifier(connectionProxy))); 45 result.m_objectStores = objectStores; 45 46 result.m_mode = mode; 46 result.m_objectStores = objectStores; 47 if (durability) 48 result.m_durability = *durability; 47 49 48 50 return result; … … 62 64 : m_identifier(info.identifier()) 63 65 , m_mode(info.m_mode) 66 , m_durability(info.m_durability) 64 67 , m_newVersion(info.m_newVersion) 65 68 , m_objectStores(info.m_objectStores) … … 83 86 destination.m_identifier = source.m_identifier.isolatedCopy(); 84 87 destination.m_mode = source.m_mode; 88 destination.m_durability = source.m_durability; 85 89 destination.m_newVersion = source.m_newVersion; 86 90 -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h
r275151 r280415 28 28 #include "IDBDatabaseInfo.h" 29 29 #include "IDBResourceIdentifier.h" 30 #include "IDBTransactionDurability.h" 30 31 #include "IDBTransactionMode.h" 31 32 #include "IndexedDB.h" … … 45 46 WTF_MAKE_FAST_ALLOCATED; 46 47 public: 47 static IDBTransactionInfo clientTransaction(const IDBClient::IDBConnectionProxy&, const Vector<String>& objectStores, IDBTransactionMode );48 static IDBTransactionInfo clientTransaction(const IDBClient::IDBConnectionProxy&, const Vector<String>& objectStores, IDBTransactionMode, std::optional<IDBTransactionDurability>); 48 49 static IDBTransactionInfo versionChange(const IDBServer::IDBConnectionToClient&, const IDBDatabaseInfo& originalDatabaseInfo, uint64_t newVersion); 49 50 … … 60 61 61 62 IDBTransactionMode mode() const { return m_mode; } 63 IDBTransactionDurability durability() const { return m_durability; } 62 64 uint64_t newVersion() const { return m_newVersion; } 63 65 … … 82 84 83 85 IDBTransactionMode m_mode { IDBTransactionMode::Readonly }; 86 IDBTransactionDurability m_durability { IDBTransactionDurability::Default }; 84 87 uint64_t m_newVersion { 0 }; 85 88 Vector<String> m_objectStores; … … 91 94 { 92 95 encoder << m_identifier << m_newVersion << m_objectStores; 93 encoder << m_mode ;96 encoder << m_mode << m_durability; 94 97 95 98 encoder << !!m_originalDatabaseInfo; … … 113 116 return false; 114 117 118 if (!decoder.decode(info.m_durability)) 119 return false; 120 115 121 bool hasObject; 116 122 if (!decoder.decode(hasObject)) -
trunk/Source/WebCore/Sources.txt
r280310 r280415 3211 3211 JSIDBRequest.cpp 3212 3212 JSIDBTransaction.cpp 3213 JSIDBTransactionDurability.cpp 3213 3214 JSIDBTransactionMode.cpp 3214 3215 JSIDBVersionChangeEvent.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r280310 r280415 2850 2850 935FBC4509BA00B900E230B1 /* EventListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 935FBC4409BA00B900E230B1 /* EventListener.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2851 2851 935FBCF209BA143B00E230B1 /* ExceptionCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 935FBCF109BA143B00E230B1 /* ExceptionCode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2852 936583B726AB92B5004E61F4 /* IDBTransactionDurability.h in Headers */ = {isa = PBXBuildFile; fileRef = 936583B626AB9174004E61F4 /* IDBTransactionDurability.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2852 2853 9370918D1416D86B00477333 /* textAreaResizeCorner@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9370918C1416D86B00477333 /* textAreaResizeCorner@2x.png */; }; 2853 2854 9377ABA015DEFEEF0031FD04 /* Pagination.h in Headers */ = {isa = PBXBuildFile; fileRef = 9377AB9F15DEFEEF0031FD04 /* Pagination.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 11707 11708 935FBC4409BA00B900E230B1 /* EventListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventListener.h; sourceTree = "<group>"; }; 11708 11709 935FBCF109BA143B00E230B1 /* ExceptionCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionCode.h; sourceTree = "<group>"; }; 11710 936583B426AB8CB4004E61F4 /* IDBTransactionDurability.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBTransactionDurability.idl; sourceTree = "<group>"; }; 11711 936583B626AB9174004E61F4 /* IDBTransactionDurability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBTransactionDurability.h; sourceTree = "<group>"; }; 11709 11712 936B21F41DBBF8300052E117 /* CanvasPath.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CanvasPath.idl; sourceTree = "<group>"; }; 11710 11713 936DD03A09CEAC270056AE8C /* Range.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Range.idl; sourceTree = "<group>"; }; … … 24433 24436 51645B511B9F889B00F789CE /* IDBTransaction.h */, 24434 24437 51D719A6181106E00016DC51 /* IDBTransaction.idl */, 24438 936583B626AB9174004E61F4 /* IDBTransactionDurability.h */, 24439 936583B426AB8CB4004E61F4 /* IDBTransactionDurability.idl */, 24435 24440 838EF5361DC149DA008F0C39 /* IDBTransactionMode.h */, 24436 24441 838EF5371DC149DA008F0C39 /* IDBTransactionMode.idl */, … … 33128 33133 5185FCBB1BB4CBF80012898F /* IDBServer.h in Headers */, 33129 33134 5185FCAD1BB4C4E80012898F /* IDBTransaction.h in Headers */, 33135 936583B726AB92B5004E61F4 /* IDBTransactionDurability.h in Headers */, 33130 33136 5198F7AD1BBDD3EB00E2CC5F /* IDBTransactionInfo.h in Headers */, 33131 33137 838EF5381DC149E2008F0C39 /* IDBTransactionMode.h in Headers */, -
trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp
r278150 r280415 193 193 } 194 194 195 static int checkpointModeValue(SQLiteDatabase::CheckpointMode mode) 196 { 197 switch (mode) { 198 case SQLiteDatabase::CheckpointMode::Full: 199 return SQLITE_CHECKPOINT_FULL; 200 case SQLiteDatabase::CheckpointMode::Truncate: 201 return SQLITE_CHECKPOINT_TRUNCATE; 202 } 203 } 204 205 void SQLiteDatabase::checkpoint(CheckpointMode mode) 206 { 207 SQLiteTransactionInProgressAutoCounter transactionCounter; 208 int result = sqlite3_wal_checkpoint_v2(m_db, nullptr, checkpointModeValue(mode), nullptr, nullptr); 209 if (result == SQLITE_OK) 210 return; 211 212 if (result == SQLITE_BUSY) { 213 LOG(SQLDatabase, "SQLite database checkpoint is blocked"); 214 return; 215 } 216 217 LOG_ERROR("SQLite database failed to checkpoint: %s", lastErrorMsg()); 218 } 219 195 220 void SQLiteDatabase::useWALJournalMode() 196 221 { … … 208 233 } 209 234 210 { 211 SQLiteTransactionInProgressAutoCounter transactionCounter; 212 auto checkpointStatement = prepareStatement("PRAGMA wal_checkpoint(TRUNCATE)"_s); 213 if (checkpointStatement && checkpointStatement->step() == SQLITE_ROW) { 214 if (checkpointStatement->columnInt(0)) 215 LOG(SQLDatabase, "SQLite database checkpoint is blocked"); 216 } else 217 LOG_ERROR("SQLite database failed to checkpoint: %s", lastErrorMsg()); 218 } 235 checkpoint(CheckpointMode::Truncate); 219 236 } 220 237 -
trunk/Source/WebCore/platform/sql/SQLiteDatabase.h
r278651 r280415 98 98 // locks, which can lead to unintended delays. 99 99 void enableAutomaticWALTruncation(); 100 enum class CheckpointMode : uint8_t { Full, Truncate }; 101 void checkpoint(CheckpointMode); 100 102 101 103 // Gets/sets the maximum size in bytes
Note: See TracChangeset
for help on using the changeset viewer.