Skip to content
Permalink
Browse files
Unreviewed, reverting r280977.
Seems to have broken a test in debug

Reverted changeset:

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



Canonical link: https://commits.webkit.org/240487@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280988 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
achristensen07 committed Aug 12, 2021
1 parent dba3abc commit e038744aaba8c22a038d913e63ee45fb4d9b46cd
Showing 3 changed files with 28 additions and 10 deletions.
@@ -1,3 +1,16 @@
2021-08-12 Alex Christensen <achristensen@webkit.org>

Unreviewed, reverting r280977.

Seems to have broken a test in debug

Reverted changeset:

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

2021-08-12 Alex Christensen <achristensen@webkit.org>

Migrate Performance::resourceTimingBufferFullTimerFired to HTML event loop
@@ -60,13 +60,20 @@ WTF_MAKE_ISO_ALLOCATED_IMPL(Performance);

Performance::Performance(ScriptExecutionContext* context, MonotonicTime timeOrigin)
: ContextDestructionObserver(context)
, m_resourceTimingBufferFullTimer(*this, &Performance::resourceTimingBufferFullTimerFired) // FIXME: Migrate this to the event loop as well. https://bugs.webkit.org/show_bug.cgi?id=229044
, m_timeOrigin(timeOrigin)
{
ASSERT(m_timeOrigin);
}

Performance::~Performance() = default;

void Performance::contextDestroyed()
{
m_resourceTimingBufferFullTimer.stop();
ContextDestructionObserver::contextDestroyed();
}

DOMHighResTimeStamp Performance::now() const
{
return nowInReducedResolutionSeconds().milliseconds();
@@ -256,14 +263,10 @@ void Performance::addResourceTiming(ResourceTiming&& resourceTiming)
}

if (isResourceTimingBufferFull()) {
ASSERT(!m_resourceTimingBufferFullTimer.isActive());
m_backupResourceTimingBuffer.append(WTFMove(entry));
m_waitingForBackupBufferToBeProcessed = true;
auto* context = scriptExecutionContext();
if (!context)
return;
context->eventLoop().queueTask(TaskSource::PerformanceTimeline, [protectedThis = makeRef(*this)] {
protectedThis->dispatchResourceTimingBufferFullEvent();
});
m_resourceTimingBufferFullTimer.startOneShot(0_s);
return;
}

@@ -276,10 +279,9 @@ bool Performance::isResourceTimingBufferFull() const
return m_resourceTimingBuffer.size() >= m_resourceTimingBufferSize;
}

void Performance::dispatchResourceTimingBufferFullEvent()
void Performance::resourceTimingBufferFullTimerFired()
{
if (!scriptExecutionContext())
return;
ASSERT(scriptExecutionContext());

while (!m_backupResourceTimingBuffer.isEmpty()) {
auto beforeCount = m_backupResourceTimingBuffer.size();
@@ -119,13 +119,15 @@ class Performance final : public RefCounted<Performance>, public ContextDestruct
private:
Performance(ScriptExecutionContext*, MonotonicTime timeOrigin);

void contextDestroyed() override;

EventTargetInterface eventTargetInterface() const final { return PerformanceEventTargetInterfaceType; }

void refEventTarget() final { ref(); }
void derefEventTarget() final { deref(); }

bool isResourceTimingBufferFull() const;
void dispatchResourceTimingBufferFullEvent();
void resourceTimingBufferFullTimerFired();

void queueEntry(PerformanceEntry&);
void scheduleTaskIfNeeded();
@@ -137,6 +139,7 @@ class Performance final : public RefCounted<Performance>, public ContextDestruct
Vector<RefPtr<PerformanceEntry>> m_resourceTimingBuffer;
unsigned m_resourceTimingBufferSize { 150 };

Timer m_resourceTimingBufferFullTimer;
Vector<RefPtr<PerformanceEntry>> m_backupResourceTimingBuffer;

// https://w3c.github.io/resource-timing/#dfn-resource-timing-buffer-full-flag

0 comments on commit e038744

Please sign in to comment.