⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 280977 in webkit


Ignore:
Timestamp:
Aug 12, 2021, 12:25:04 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Migrate Performance::resourceTimingBufferFullTimerFired to HTML event loop
https://bugs.webkit.org/show_bug.cgi?id=229044

Patch by Alex Christensen <achristensen@webkit.org> on 2021-08-12
Reviewed by Geoff Garen.

Covered by existing tests.
There should be no change in behavior.

  • page/Performance.cpp:

(WebCore::Performance::Performance):
(WebCore::Performance::addResourceTiming):
(WebCore::Performance::dispatchResourceTimingBufferFullEvent):
(WebCore::Performance::contextDestroyed): Deleted.
(WebCore::Performance::resourceTimingBufferFullTimerFired): Deleted.

  • page/Performance.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r280976 r280977  
     12021-08-12  Alex Christensen  <achristensen@webkit.org>
     2
     3        Migrate Performance::resourceTimingBufferFullTimerFired to HTML event loop
     4        https://bugs.webkit.org/show_bug.cgi?id=229044
     5
     6        Reviewed by Geoff Garen.
     7
     8        Covered by existing tests.
     9        There should be no change in behavior.
     10
     11        * page/Performance.cpp:
     12        (WebCore::Performance::Performance):
     13        (WebCore::Performance::addResourceTiming):
     14        (WebCore::Performance::dispatchResourceTimingBufferFullEvent):
     15        (WebCore::Performance::contextDestroyed): Deleted.
     16        (WebCore::Performance::resourceTimingBufferFullTimerFired): Deleted.
     17        * page/Performance.h:
     18
    1192021-08-12  Jer Noble  <jer.noble@apple.com>
    220
  • trunk/Source/WebCore/page/Performance.cpp

    r279203 r280977  
    6161Performance::Performance(ScriptExecutionContext* context, MonotonicTime timeOrigin)
    6262    : ContextDestructionObserver(context)
    63     , m_resourceTimingBufferFullTimer(*this, &Performance::resourceTimingBufferFullTimerFired) // FIXME: Migrate this to the event loop as well.
    6463    , m_timeOrigin(timeOrigin)
    6564{
     
    6867
    6968Performance::~Performance() = default;
    70 
    71 void Performance::contextDestroyed()
    72 {
    73     m_resourceTimingBufferFullTimer.stop();
    74     ContextDestructionObserver::contextDestroyed();
    75 }
    7669
    7770DOMHighResTimeStamp Performance::now() const
     
    264257
    265258    if (isResourceTimingBufferFull()) {
    266         ASSERT(!m_resourceTimingBufferFullTimer.isActive());
    267259        m_backupResourceTimingBuffer.append(WTFMove(entry));
    268260        m_waitingForBackupBufferToBeProcessed = true;
    269         m_resourceTimingBufferFullTimer.startOneShot(0_s);
     261        auto* context = scriptExecutionContext();
     262        if (!context)
     263            return;
     264        context->eventLoop().queueTask(TaskSource::PerformanceTimeline, [protectedThis = makeRef(*this)] {
     265            protectedThis->dispatchResourceTimingBufferFullEvent();
     266        });
    270267        return;
    271268    }
     
    280277}
    281278
    282 void Performance::resourceTimingBufferFullTimerFired()
    283 {
    284     ASSERT(scriptExecutionContext());
     279void Performance::dispatchResourceTimingBufferFullEvent()
     280{
     281    if (!scriptExecutionContext())
     282        return;
    285283
    286284    while (!m_backupResourceTimingBuffer.isEmpty()) {
  • trunk/Source/WebCore/page/Performance.h

    r279203 r280977  
    120120    Performance(ScriptExecutionContext*, MonotonicTime timeOrigin);
    121121
    122     void contextDestroyed() override;
    123 
    124122    EventTargetInterface eventTargetInterface() const final { return PerformanceEventTargetInterfaceType; }
    125123
     
    128126
    129127    bool isResourceTimingBufferFull() const;
    130     void resourceTimingBufferFullTimerFired();
     128    void dispatchResourceTimingBufferFullEvent();
    131129
    132130    void queueEntry(PerformanceEntry&);
     
    140138    unsigned m_resourceTimingBufferSize { 150 };
    141139
    142     Timer m_resourceTimingBufferFullTimer;
    143140    Vector<RefPtr<PerformanceEntry>> m_backupResourceTimingBuffer;
    144141
Note: See TracChangeset for help on using the changeset viewer.