Changeset 250732 in webkit


Ignore:
Timestamp:
Oct 4, 2019 11:26:19 AM (5 years ago)
Author:
sihui_liu@apple.com
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:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r250731 r250732  
     12019-10-04  Sihui Liu  <sihui_liu@apple.com>
     2
     3        Layout Test imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception.html is a Flaky Failure
     4        https://bugs.webkit.org/show_bug.cgi?id=201481
     5        <rdar://problem/55046055>
     6
     7        Reviewed by Alex Christensen.
     8
     9        We should not schedule timer if we know the timer function will be no-op.
     10
     11        * Modules/indexeddb/IDBTransaction.cpp:
     12        (WebCore::IDBTransaction::removeRequest):
     13        (WebCore::IDBTransaction::scheduleOperation):
     14        (WebCore::IDBTransaction::trySchedulePendingOperationTimer):
     15        (WebCore::IDBTransaction::pendingOperationTimerFired):
     16        (WebCore::IDBTransaction::didStart):
     17        (WebCore::IDBTransaction::operationCompletedOnClient):
     18        (WebCore::IDBTransaction::deactivate):
     19        (WebCore::IDBTransaction::schedulePendingOperationTimer): Deleted.
     20        * Modules/indexeddb/IDBTransaction.h:
     21
    1222019-10-04  Chris Dumez  <cdumez@apple.com>
    223
  • trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp

    r250531 r250732  
    384384    ASSERT(&m_database->originThread() == &Thread::current());
    385385    m_openRequests.remove(&request);
     386
     387    trySchedulePendingOperationTimer();
    386388}
    387389
     
    395397    m_transactionOperationMap.set(identifier, WTFMove(operation));
    396398
    397     schedulePendingOperationTimer();
    398 }
    399 
    400 void IDBTransaction::schedulePendingOperationTimer()
    401 {
    402     ASSERT(&m_database->originThread() == &Thread::current());
    403 
    404     if (!m_pendingOperationTimer.isActive())
    405         m_pendingOperationTimer.startOneShot(0_s);
    406 }
    407 
    408 void IDBTransaction::pendingOperationTimerFired()
    409 {
    410     LOG(IndexedDB, "IDBTransaction::pendingOperationTimerFired (%p)", this);
     399    trySchedulePendingOperationTimer();
     400}
     401
     402void IDBTransaction::trySchedulePendingOperationTimer()
     403{
    411404    ASSERT(&m_database->originThread() == &Thread::current());
    412405
     
    418411    if (!m_transactionOperationsInProgressQueue.isEmpty() && !m_transactionOperationsInProgressQueue.last()->nextRequestCanGoToServer())
    419412        return;
     413
     414    if (m_pendingTransactionOperationQueue.isEmpty() && (!m_transactionOperationMap.isEmpty() || !m_openRequests.isEmpty() || isFinishedOrFinishing()))
     415        return;
     416
     417    if (!m_pendingOperationTimer.isActive())
     418        m_pendingOperationTimer.startOneShot(0_s);
     419}
     420
     421void IDBTransaction::pendingOperationTimerFired()
     422{
     423    LOG(IndexedDB, "IDBTransaction::pendingOperationTimerFired (%p)", this);
     424    ASSERT(&m_database->originThread() == &Thread::current());
    420425
    421426    // We want to batch operations together without spinning the runloop for performance,
     
    558563    }
    559564
    560     schedulePendingOperationTimer();
     565    trySchedulePendingOperationTimer();
    561566}
    562567
     
    14111416    m_transactionOperationsInProgressQueue.removeFirst();
    14121417
    1413     schedulePendingOperationTimer();
     1418    trySchedulePendingOperationTimer();
    14141419}
    14151420
     
    14391444        m_state = IndexedDB::TransactionState::Inactive;
    14401445
    1441     schedulePendingOperationTimer();
     1446    trySchedulePendingOperationTimer();
    14421447}
    14431448
  • trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h

    r250661 r250732  
    230230    void completeCursorRequest(IDBRequest&, const IDBResultData&);
    231231
    232     void schedulePendingOperationTimer();
     232    void trySchedulePendingOperationTimer();
    233233    void scheduleCompletedOperationTimer();
    234234
Note: See TracChangeset for help on using the changeset viewer.