Changeset 194173 in webkit
- Timestamp:
- Dec 16, 2015 1:52:11 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r194169 r194173 1 2015-12-16 Brady Eidson <beidson@apple.com> 2 3 Modern IDB: Refactor UniqueIDBDatabase in preparation for consolidation open and delete requests. 4 https://bugs.webkit.org/show_bug.cgi?id=152355 5 6 Reviewed by Alex Christensen. 7 8 No new tests (Refactor, existing tests pass). 9 10 * Modules/indexeddb/server/UniqueIDBDatabase.cpp: 11 (WebCore::IDBServer::UniqueIDBDatabase::openDatabaseConnection): 12 (WebCore::IDBServer::UniqueIDBDatabase::performCurrentOpenOperation): 13 (WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation): 14 (WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations): 15 (WebCore::IDBServer::UniqueIDBDatabase::didOpenBackingStore): 16 (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired): 17 (WebCore::IDBServer::UniqueIDBDatabase::handleOpenDatabaseOperations): Deleted. 18 * Modules/indexeddb/server/UniqueIDBDatabase.h: 19 1 20 2015-12-16 Brady Eidson <beidson@apple.com> 2 21 -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
r194169 r194173 68 68 69 69 if (m_databaseInfo) { 70 handle OpenDatabaseOperations();70 handleDatabaseOperations(); 71 71 return; 72 72 } … … 119 119 } 120 120 121 void UniqueIDBDatabase::handleOpenDatabaseOperations() 122 { 123 ASSERT(isMainThread()); 124 LOG(IndexedDB, "(main) UniqueIDBDatabase::handleOpenDatabaseOperations"); 125 126 // If a version change transaction is currently in progress, no new connections can be opened right now. 127 // We will try again later. 128 if (m_versionChangeDatabaseConnection) 129 return; 130 131 if (m_pendingOpenDatabaseOperations.isEmpty()) 132 return; 133 134 auto operation = m_pendingOpenDatabaseOperations.takeFirst(); 121 void UniqueIDBDatabase::performCurrentOpenOperation() 122 { 123 LOG(IndexedDB, "(main) UniqueIDBDatabase::performCurrentOpenOperation"); 124 125 ASSERT(m_currentOperation); 126 ASSERT(m_currentOperation->isOpenRequest()); 135 127 136 128 // 3.3.1 Opening a database 137 129 // If requested version is undefined, then let requested version be 1 if db was created in the previous step, 138 130 // or the current version of db otherwise. 139 uint64_t requestedVersion = operation->requestData().requestedVersion();131 uint64_t requestedVersion = m_currentOperation->requestData().requestedVersion(); 140 132 if (!requestedVersion) 141 133 requestedVersion = m_databaseInfo->version() ? m_databaseInfo->version() : 1; … … 144 136 // If the database version higher than the requested version, abort these steps and return a VersionError. 145 137 if (requestedVersion < m_databaseInfo->version()) { 146 auto result = IDBResultData::error(operation->requestData().requestIdentifier(), IDBError(IDBDatabaseException::VersionError)); 147 operation->connection().didOpenDatabase(result); 148 return; 149 } 150 151 Ref<UniqueIDBDatabaseConnection> connection = UniqueIDBDatabaseConnection::create(*this, operation->connection()); 138 auto result = IDBResultData::error(m_currentOperation->requestData().requestIdentifier(), IDBError(IDBDatabaseException::VersionError)); 139 m_currentOperation->connection().didOpenDatabase(result); 140 m_currentOperation = nullptr; 141 142 return; 143 } 144 145 Ref<UniqueIDBDatabaseConnection> connection = UniqueIDBDatabaseConnection::create(*this, m_currentOperation->connection()); 152 146 UniqueIDBDatabaseConnection* rawConnection = &connection.get(); 153 147 … … 155 149 addOpenDatabaseConnection(WTF::move(connection)); 156 150 157 auto result = IDBResultData::openDatabaseSuccess(operation->requestData().requestIdentifier(), *rawConnection); 158 operation->connection().didOpenDatabase(result); 159 return; 160 } 161 162 ASSERT(!m_currentOperation); 151 auto result = IDBResultData::openDatabaseSuccess(m_currentOperation->requestData().requestIdentifier(), *rawConnection); 152 m_currentOperation->connection().didOpenDatabase(result); 153 m_currentOperation = nullptr; 154 155 return; 156 } 157 163 158 ASSERT(!m_versionChangeDatabaseConnection); 164 165 m_currentOperation = WTF::move(operation);166 159 m_versionChangeDatabaseConnection = rawConnection; 167 160 … … 178 171 // And we notify this OpenDBRequest that it is blocked until those connections close. 179 172 m_versionChangeDatabaseConnection->connectionToClient().notifyOpenDBRequestBlocked(m_currentOperation->requestData().requestIdentifier(), m_databaseInfo->version(), requestedVersion); 173 } 174 175 void UniqueIDBDatabase::performCurrentDeleteOperation() 176 { 177 LOG(IndexedDB, "(main) UniqueIDBDatabase::performCurrentDeleteOperation"); 178 179 // Not used yet. 180 } 181 182 void UniqueIDBDatabase::handleDatabaseOperations() 183 { 184 ASSERT(isMainThread()); 185 LOG(IndexedDB, "(main) UniqueIDBDatabase::handleDatabaseOperations"); 186 187 // If a version change transaction is currently in progress, no new connections can be opened right now. 188 // We will try again later. 189 if (m_versionChangeDatabaseConnection) 190 return; 191 192 if (m_pendingOpenDatabaseOperations.isEmpty()) 193 return; 194 195 if (m_currentOperation) 196 return; 197 198 m_currentOperation = m_pendingOpenDatabaseOperations.takeFirst(); 199 200 // FIXME: Once handleDatabaseOperations also handles delete operations, remove this ASSERT. 201 ASSERT(m_currentOperation->isOpenRequest()); 202 203 if (m_currentOperation->isOpenRequest()) 204 performCurrentOpenOperation(); 205 else if (m_currentOperation->isDeleteRequest()) 206 performCurrentDeleteOperation(); 207 else 208 ASSERT_NOT_REACHED(); 180 209 } 181 210 … … 327 356 m_isOpeningBackingStore = false; 328 357 329 handle OpenDatabaseOperations();358 handleDatabaseOperations(); 330 359 } 331 360 … … 917 946 LOG(IndexedDB, "(main) UniqueIDBDatabase::operationAndTransactionTimerFired"); 918 947 919 handle OpenDatabaseOperations();948 handleDatabaseOperations(); 920 949 921 950 if (m_deletePending && maybeDeleteDatabase(nullptr)) -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h
r194169 r194173 105 105 UniqueIDBDatabase(IDBServer&, const IDBDatabaseIdentifier&); 106 106 107 void handleOpenDatabaseOperations(); 107 void handleDatabaseOperations(); 108 void performCurrentOpenOperation(); 109 void performCurrentDeleteOperation(); 108 110 void addOpenDatabaseConnection(Ref<UniqueIDBDatabaseConnection>&&); 109 111 bool maybeDeleteDatabase(IDBServerOperation*);
Note: See TracChangeset
for help on using the changeset viewer.