Title: [203241] trunk/Source/WebCore
Revision
203241
Author
[email protected]
Date
2016-07-14 14:15:28 -0700 (Thu, 14 Jul 2016)

Log Message

"User delete" tests are flakey timeouts (and/or DatabaseProcess crashes).
https://bugs.webkit.org/show_bug.cgi?id=158741

Reviewed by Alex Christensen.

No new tests (Covered by existing tests in some configurations)

- Check if a database hard delete is complete in more places.
- Asynchronously clear out the hard close protector instead of synchronously.

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::~UniqueIDBDatabase):
(WebCore::IDBServer::UniqueIDBDatabase::didPerformUnconditionalDeleteBackingStore):
(WebCore::IDBServer::UniqueIDBDatabase::didFinishHandlingVersionChange):
(WebCore::IDBServer::UniqueIDBDatabase::connectionClosedFromClient):
(WebCore::IDBServer::UniqueIDBDatabase::transactionCompleted):
(WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTaskReply):
(WebCore::IDBServer::UniqueIDBDatabase::maybeFinishHardClose):
(WebCore::IDBServer::UniqueIDBDatabase::isDoneWithHardClose):
(WebCore::IDBServer::UniqueIDBDatabase::doneWithHardClose): Deleted.

* Modules/indexeddb/server/UniqueIDBDatabase.h:
(WebCore::IDBServer::UniqueIDBDatabase::hardClosedForUserDelete):

* Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didAbortTransaction):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (203240 => 203241)


--- trunk/Source/WebCore/ChangeLog	2016-07-14 21:01:23 UTC (rev 203240)
+++ trunk/Source/WebCore/ChangeLog	2016-07-14 21:15:28 UTC (rev 203241)
@@ -1,3 +1,32 @@
+2016-07-14  Brady Eidson  <[email protected]>
+
+        "User delete" tests are flakey timeouts (and/or DatabaseProcess crashes).
+        https://bugs.webkit.org/show_bug.cgi?id=158741
+
+        Reviewed by Alex Christensen.
+
+        No new tests (Covered by existing tests in some configurations)
+
+        - Check if a database hard delete is complete in more places.
+        - Asynchronously clear out the hard close protector instead of synchronously.
+        
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabase::~UniqueIDBDatabase):
+        (WebCore::IDBServer::UniqueIDBDatabase::didPerformUnconditionalDeleteBackingStore):
+        (WebCore::IDBServer::UniqueIDBDatabase::didFinishHandlingVersionChange):
+        (WebCore::IDBServer::UniqueIDBDatabase::connectionClosedFromClient):
+        (WebCore::IDBServer::UniqueIDBDatabase::transactionCompleted):
+        (WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTaskReply):
+        (WebCore::IDBServer::UniqueIDBDatabase::maybeFinishHardClose):
+        (WebCore::IDBServer::UniqueIDBDatabase::isDoneWithHardClose):
+        (WebCore::IDBServer::UniqueIDBDatabase::doneWithHardClose): Deleted.
+
+        * Modules/indexeddb/server/UniqueIDBDatabase.h:
+        (WebCore::IDBServer::UniqueIDBDatabase::hardClosedForUserDelete):
+
+        * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabaseConnection::didAbortTransaction):
+
 2016-07-13  Brent Fulgham  <[email protected]>
 
         CSSStyleSheet members should clear their owner node when destroyed

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (203240 => 203241)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp	2016-07-14 21:01:23 UTC (rev 203240)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp	2016-07-14 21:15:28 UTC (rev 203241)
@@ -59,6 +59,7 @@
 UniqueIDBDatabase::~UniqueIDBDatabase()
 {
     LOG(IndexedDB, "UniqueIDBDatabase::~UniqueIDBDatabase() (%p) %s", this, m_identifier.debugString().utf8().data());
+    ASSERT(isMainThread());
     ASSERT(!hasAnyPendingCallbacks());
     ASSERT(!hasUnfinishedTransactions());
     ASSERT(m_pendingTransactions.isEmpty());
@@ -298,6 +299,12 @@
     invokeOperationAndTransactionTimer();
 }
 
+void UniqueIDBDatabase::didPerformUnconditionalDeleteBackingStore()
+{
+    // This function is a placeholder so the database thread can message back to the main thread.
+    ASSERT(m_hardClosedForUserDelete);
+}
+
 void UniqueIDBDatabase::handleDatabaseOperations()
 {
     ASSERT(isMainThread());
@@ -1169,6 +1176,11 @@
     m_versionChangeTransaction = nullptr;
     m_versionChangeDatabaseConnection = nullptr;
 
+    if (m_hardClosedForUserDelete) {
+        maybeFinishHardClose();
+        return;
+    }
+
     invokeOperationAndTransactionTimer();
 }
 
@@ -1258,6 +1270,11 @@
         return;
     }
 
+    if (m_hardClosedForUserDelete) {
+        maybeFinishHardClose();
+        return;
+    }
+
     // Now that a database connection has closed, previously blocked operations might be runnable.
     invokeOperationAndTransactionTimer();
 }
@@ -1503,6 +1520,8 @@
     // Previously blocked operations might be runnable.
     if (!m_hardClosedForUserDelete)
         invokeOperationAndTransactionTimer();
+    else
+        maybeFinishHardClose();
 }
 
 void UniqueIDBDatabase::postDatabaseTask(CrossThreadTask&& task)
@@ -1554,12 +1573,21 @@
 
     // If this database was force closed (e.g. for a user delete) and there are no more
     // cleanup tasks left, delete this.
-    if (m_hardCloseProtector && doneWithHardClose())
-        m_hardCloseProtector = nullptr;
+    maybeFinishHardClose();
 }
 
-bool UniqueIDBDatabase::doneWithHardClose()
+void UniqueIDBDatabase::maybeFinishHardClose()
 {
+    if (m_hardCloseProtector && isDoneWithHardClose()) {
+        callOnMainThread([this] {
+            ASSERT(isDoneWithHardClose());
+            m_hardCloseProtector = nullptr;
+        });
+    }
+}
+
+bool UniqueIDBDatabase::isDoneWithHardClose()
+{
     return !m_queuedTaskCount && m_clientClosePendingDatabaseConnections.isEmpty() && m_serverClosePendingDatabaseConnections.isEmpty();
 }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h (203240 => 203241)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h	2016-07-14 21:01:23 UTC (rev 203240)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h	2016-07-14 21:15:28 UTC (rev 203241)
@@ -115,6 +115,8 @@
     static JSC::VM& databaseThreadVM();
     static JSC::ExecState& databaseThreadExecState();
 
+    bool hardClosedForUserDelete() const { return m_hardClosedForUserDelete; }
+
 private:
     UniqueIDBDatabase(IDBServer&, const IDBDatabaseIdentifier&);
     
@@ -173,6 +175,7 @@
     void didPerformCommitTransaction(uint64_t callbackIdentifier, const IDBError&, const IDBResourceIdentifier& transactionIdentifier);
     void didPerformAbortTransaction(uint64_t callbackIdentifier, const IDBError&, const IDBResourceIdentifier& transactionIdentifier);
     void didPerformActivateTransactionInBackingStore(uint64_t callbackIdentifier, const IDBError&);
+    void didPerformUnconditionalDeleteBackingStore();
 
     uint64_t storeCallbackOrFireError(ErrorCallback);
     uint64_t storeCallbackOrFireError(KeyDataCallback);
@@ -201,7 +204,8 @@
     void executeNextDatabaseTask();
     void executeNextDatabaseTaskReply();
 
-    bool doneWithHardClose();
+    void maybeFinishHardClose();
+    bool isDoneWithHardClose();
 
     IDBServer& m_server;
     IDBDatabaseIdentifier m_identifier;

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp (203240 => 203241)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp	2016-07-14 21:01:23 UTC (rev 203240)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp	2016-07-14 21:15:28 UTC (rev 203241)
@@ -151,11 +151,11 @@
     LOG(IndexedDB, "UniqueIDBDatabaseConnection::didAbortTransaction - %s - %" PRIu64, m_openRequestIdentifier.loggingString().utf8().data(), m_identifier);
 
     auto transactionIdentifier = transaction.info().identifier();
+    auto takenTransaction = m_transactionMap.take(transactionIdentifier);
 
-    ASSERT(m_transactionMap.contains(transactionIdentifier));
-    m_transactionMap.remove(transactionIdentifier);
-
-    m_connectionToClient.didAbortTransaction(transactionIdentifier, error);
+    ASSERT(takenTransaction || m_database.hardClosedForUserDelete());
+    if (takenTransaction)
+        m_connectionToClient.didAbortTransaction(transactionIdentifier, error);
 }
 
 void UniqueIDBDatabaseConnection::didCommitTransaction(UniqueIDBDatabaseTransaction& transaction, const IDBError& error)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to