Title: [250732] trunk/Source/WebCore
- Revision
- 250732
- Author
- [email protected]
- Date
- 2019-10-04 11:26:19 -0700 (Fri, 04 Oct 2019)
Log Message
Layout Test imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception.html is a Flaky Failure
https://bugs.webkit.org/show_bug.cgi?id=201481
<rdar://problem/55046055>
Reviewed by Alex Christensen.
We should not schedule timer if we know the timer function will be no-op.
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::removeRequest):
(WebCore::IDBTransaction::scheduleOperation):
(WebCore::IDBTransaction::trySchedulePendingOperationTimer):
(WebCore::IDBTransaction::pendingOperationTimerFired):
(WebCore::IDBTransaction::didStart):
(WebCore::IDBTransaction::operationCompletedOnClient):
(WebCore::IDBTransaction::deactivate):
(WebCore::IDBTransaction::schedulePendingOperationTimer): Deleted.
* Modules/indexeddb/IDBTransaction.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (250731 => 250732)
--- trunk/Source/WebCore/ChangeLog 2019-10-04 18:16:32 UTC (rev 250731)
+++ trunk/Source/WebCore/ChangeLog 2019-10-04 18:26:19 UTC (rev 250732)
@@ -1,3 +1,24 @@
+2019-10-04 Sihui Liu <[email protected]>
+
+ Layout Test imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception.html is a Flaky Failure
+ https://bugs.webkit.org/show_bug.cgi?id=201481
+ <rdar://problem/55046055>
+
+ Reviewed by Alex Christensen.
+
+ We should not schedule timer if we know the timer function will be no-op.
+
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::removeRequest):
+ (WebCore::IDBTransaction::scheduleOperation):
+ (WebCore::IDBTransaction::trySchedulePendingOperationTimer):
+ (WebCore::IDBTransaction::pendingOperationTimerFired):
+ (WebCore::IDBTransaction::didStart):
+ (WebCore::IDBTransaction::operationCompletedOnClient):
+ (WebCore::IDBTransaction::deactivate):
+ (WebCore::IDBTransaction::schedulePendingOperationTimer): Deleted.
+ * Modules/indexeddb/IDBTransaction.h:
+
2019-10-04 Chris Dumez <[email protected]>
Unreviewed follow-up fix for r250693 to address assertion hits in debug.
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (250731 => 250732)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2019-10-04 18:16:32 UTC (rev 250731)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2019-10-04 18:26:19 UTC (rev 250732)
@@ -383,6 +383,8 @@
{
ASSERT(&m_database->originThread() == &Thread::current());
m_openRequests.remove(&request);
+
+ trySchedulePendingOperationTimer();
}
void IDBTransaction::scheduleOperation(Ref<IDBClient::TransactionOperation>&& operation)
@@ -394,13 +396,24 @@
m_pendingTransactionOperationQueue.append(operation.copyRef());
m_transactionOperationMap.set(identifier, WTFMove(operation));
- schedulePendingOperationTimer();
+ trySchedulePendingOperationTimer();
}
-void IDBTransaction::schedulePendingOperationTimer()
+void IDBTransaction::trySchedulePendingOperationTimer()
{
ASSERT(&m_database->originThread() == &Thread::current());
+ if (!m_startedOnServer)
+ return;
+
+ // If the last in-progress operation we've sent to the server is not an IDBRequest operation,
+ // then we have to wait until it completes before sending any more.
+ if (!m_transactionOperationsInProgressQueue.isEmpty() && !m_transactionOperationsInProgressQueue.last()->nextRequestCanGoToServer())
+ return;
+
+ if (m_pendingTransactionOperationQueue.isEmpty() && (!m_transactionOperationMap.isEmpty() || !m_openRequests.isEmpty() || isFinishedOrFinishing()))
+ return;
+
if (!m_pendingOperationTimer.isActive())
m_pendingOperationTimer.startOneShot(0_s);
}
@@ -410,14 +423,6 @@
LOG(IndexedDB, "IDBTransaction::pendingOperationTimerFired (%p)", this);
ASSERT(&m_database->originThread() == &Thread::current());
- if (!m_startedOnServer)
- return;
-
- // If the last in-progress operation we've sent to the server is not an IDBRequest operation,
- // then we have to wait until it completes before sending any more.
- if (!m_transactionOperationsInProgressQueue.isEmpty() && !m_transactionOperationsInProgressQueue.last()->nextRequestCanGoToServer())
- return;
-
// We want to batch operations together without spinning the runloop for performance,
// but don't want to affect responsiveness of the main thread.
// This number is a good compromise in ad-hoc testing.
@@ -557,7 +562,7 @@
return;
}
- schedulePendingOperationTimer();
+ trySchedulePendingOperationTimer();
}
void IDBTransaction::notifyDidAbort(const IDBError& error)
@@ -1410,7 +1415,7 @@
m_transactionOperationMap.remove(operation.identifier());
m_transactionOperationsInProgressQueue.removeFirst();
- schedulePendingOperationTimer();
+ trySchedulePendingOperationTimer();
}
void IDBTransaction::establishOnServer()
@@ -1438,7 +1443,7 @@
if (m_state == IndexedDB::TransactionState::Active)
m_state = IndexedDB::TransactionState::Inactive;
- schedulePendingOperationTimer();
+ trySchedulePendingOperationTimer();
}
void IDBTransaction::connectionClosedFromServer(const IDBError& error)
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h (250731 => 250732)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h 2019-10-04 18:16:32 UTC (rev 250731)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h 2019-10-04 18:26:19 UTC (rev 250732)
@@ -229,7 +229,7 @@
void completeNoncursorRequest(IDBRequest&, const IDBResultData&);
void completeCursorRequest(IDBRequest&, const IDBResultData&);
- void schedulePendingOperationTimer();
+ void trySchedulePendingOperationTimer();
void scheduleCompletedOperationTimer();
Ref<IDBDatabase> m_database;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes