<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[278544] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/278544">278544</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2021-06-06 23:16:22 -0700 (Sun, 06 Jun 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Drop MainThreadTaskDispatcher and use callOnMainThread() instead
https://bugs.webkit.org/show_bug.cgi?id=226701

Reviewed by Darin Adler.

Drop MainThreadTaskDispatcher and use callOnMainThread() instead. There is a no need for a
global Timer or a Deque of tasks.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/DeferrableTask.h:
(WebCore::MainThreadDeferrableTask::scheduleTask):
* platform/GenericTaskQueue.cpp: Removed.
* platform/GenericTaskQueue.h:
(WebCore::MainThreadTaskQueue::MainThreadTaskQueue):
(WebCore::MainThreadTaskQueue::enqueueTask):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreSourcestxt">trunk/Source/WebCore/Sources.txt</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformDeferrableTaskh">trunk/Source/WebCore/platform/DeferrableTask.h</a></li>
<li><a href="#trunkSourceWebCoreplatformGenericTaskQueueh">trunk/Source/WebCore/platform/GenericTaskQueue.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformGenericTaskQueuecpp">trunk/Source/WebCore/platform/GenericTaskQueue.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (278543 => 278544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-06-07 04:22:38 UTC (rev 278543)
+++ trunk/Source/WebCore/ChangeLog      2021-06-07 06:16:22 UTC (rev 278544)
</span><span class="lines">@@ -1,5 +1,24 @@
</span><span class="cx"> 2021-06-06  Chris Dumez  <cdumez@apple.com>
</span><span class="cx"> 
</span><ins>+        Drop MainThreadTaskDispatcher and use callOnMainThread() instead
+        https://bugs.webkit.org/show_bug.cgi?id=226701
+
+        Reviewed by Darin Adler.
+
+        Drop MainThreadTaskDispatcher and use callOnMainThread() instead. There is a no need for a
+        global Timer or a Deque of tasks.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/DeferrableTask.h:
+        (WebCore::MainThreadDeferrableTask::scheduleTask):
+        * platform/GenericTaskQueue.cpp: Removed.
+        * platform/GenericTaskQueue.h:
+        (WebCore::MainThreadTaskQueue::MainThreadTaskQueue):
+        (WebCore::MainThreadTaskQueue::enqueueTask):
+
+2021-06-06  Chris Dumez  <cdumez@apple.com>
+
</ins><span class="cx">         Stop using legacy EventLoopDeferrableTask
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=226700
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreSourcestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Sources.txt (278543 => 278544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Sources.txt 2021-06-07 04:22:38 UTC (rev 278543)
+++ trunk/Source/WebCore/Sources.txt    2021-06-07 06:16:22 UTC (rev 278544)
</span><span class="lines">@@ -1834,7 +1834,6 @@
</span><span class="cx"> platform/FileMonitor.cpp
</span><span class="cx"> platform/FileStream.cpp
</span><span class="cx"> platform/FrameRateMonitor.cpp
</span><del>-platform/GenericTaskQueue.cpp
</del><span class="cx"> platform/LayoutUnit.cpp
</span><span class="cx"> platform/LegacySchemeRegistry.cpp
</span><span class="cx"> platform/Length.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (278543 => 278544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj   2021-06-07 04:22:38 UTC (rev 278543)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj      2021-06-07 06:16:22 UTC (rev 278544)
</span><span class="lines">@@ -14943,7 +14943,6 @@
</span><span class="cx">          CD3E252118046BCD00E27F56 /* CSSGridTemplateAreasValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSGridTemplateAreasValue.cpp; sourceTree = "<group>"; };
</span><span class="cx">          CD3E252218046BCD00E27F56 /* CSSGridTemplateAreasValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSGridTemplateAreasValue.h; sourceTree = "<group>"; };
</span><span class="cx">          CD4AC5281496AE2F0087C4EF /* Composite.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = Composite.wav; path = platform/audio/resources/Composite.wav; sourceTree = SOURCE_ROOT; };
</span><del>-               CD4BE5291CE13425009D87DA /* GenericTaskQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericTaskQueue.cpp; sourceTree = "<group>"; };
</del><span class="cx">           CD4E0AFA11F7BC27009D3811 /* fullscreen.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = fullscreen.css; sourceTree = "<group>"; };
</span><span class="cx">          CD4E4E602357B317007895C3 /* HdrMetadataType.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HdrMetadataType.idl; sourceTree = "<group>"; };
</span><span class="cx">          CD4E4E622357B3AD007895C3 /* TransferFunction.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TransferFunction.idl; sourceTree = "<group>"; };
</span><span class="lines">@@ -28067,7 +28066,6 @@
</span><span class="cx">                          BC073BA90C399B1F000F5979 /* FloatConversion.h */,
</span><span class="cx">                          4190F3A1249D152700531C57 /* FrameRateMonitor.cpp */,
</span><span class="cx">                          4190F3A3249D152800531C57 /* FrameRateMonitor.h */,
</span><del>-                               CD4BE5291CE13425009D87DA /* GenericTaskQueue.cpp */,
</del><span class="cx">                           CD62FB941AF018E70012ED7D /* GenericTaskQueue.h */,
</span><span class="cx">                          A8748BDF12CBF2DC001FBA41 /* HashTools.h */,
</span><span class="cx">                          BC3BC29B0E91AB0F00835588 /* HostWindow.h */,
</span><span class="lines">@@ -32564,7 +32562,6 @@
</span><span class="cx">                          63F5D4F70E8C4B7100C0BD04 /* ElementRareData.h in Headers */,
</span><span class="cx">                          FBDB619F16D6036500BB3394 /* ElementRuleCollector.h in Headers */,
</span><span class="cx">                          E4D58EBB17B8F12800CBDCA8 /* ElementTraversal.h in Headers */,
</span><del>-                               A8CFF6BE0A156118000A4234 /* LegacyEllipsisBox.h in Headers */,
</del><span class="cx">                           F55B3DBC1251F12D003EF269 /* EmailInputType.h in Headers */,
</span><span class="cx">                          B25599A50D00D8BA00BB825C /* EmptyClients.h in Headers */,
</span><span class="cx">                          414DEDE71F9FE91E0047C40D /* EmptyFrameLoaderClient.h in Headers */,
</span><span class="lines">@@ -33139,7 +33136,6 @@
</span><span class="cx">                          CD063F831E23FA8900812BE3 /* InitDataRegistry.h in Headers */,
</span><span class="cx">                          E30592641E27A3AD00D57C98 /* InlineClassicScript.h in Headers */,
</span><span class="cx">                          6FE198172178397C00446F08 /* InlineContentBreaker.h in Headers */,
</span><del>-                               B57CB52E182A3EFC0079A647 /* LegacyInlineElementBox.h in Headers */,
</del><span class="cx">                           6F7CA3CA208C2B2E002F29AB /* InlineFormattingContext.h in Headers */,
</span><span class="cx">                          47C4D57D26508BCB00C7AB1F /* InlineFormattingGeometry.h in Headers */,
</span><span class="cx">                          6FE636E82647962900F0951E /* InlineFormattingQuirks.h in Headers */,
</span><span class="lines">@@ -33156,7 +33152,6 @@
</span><span class="cx">                          E4D33F3B252AEECD00837D05 /* InlineRunAndOffset.h in Headers */,
</span><span class="cx">                          6F360E5023999421001512A7 /* InlineSoftLineBreakItem.h in Headers */,
</span><span class="cx">                          AA4C3A770B2B1679002334A2 /* InlineStyleSheetOwner.h in Headers */,
</span><del>-                               BCEA485A097D93020094C9E4 /* LegacyInlineTextBox.h in Headers */,
</del><span class="cx">                           1C010701192594DF008A4201 /* InlineTextBoxStyle.h in Headers */,
</span><span class="cx">                          6F1CC1DE225F8B4900720AD2 /* InlineTextItem.h in Headers */,
</span><span class="cx">                          1CE8864126105BF2000C816C /* InMemoryDisplayList.h in Headers */,
</span><span class="lines">@@ -34161,8 +34156,11 @@
</span><span class="cx">                          CDF4B7121E0087AE00E235A2 /* LegacyCDMSession.h in Headers */,
</span><span class="cx">                          CDE8B5F11A69778B00B4B66A /* LegacyCDMSessionClearKey.h in Headers */,
</span><span class="cx">                          2DE70023192FE82A00B0975C /* LegacyDisplayRefreshMonitorMac.h in Headers */,
</span><ins>+                               A8CFF6BE0A156118000A4234 /* LegacyEllipsisBox.h in Headers */,
</ins><span class="cx">                           A8CFF5E50A155A05000A4234 /* LegacyInlineBox.h in Headers */,
</span><ins>+                               B57CB52E182A3EFC0079A647 /* LegacyInlineElementBox.h in Headers */,
</ins><span class="cx">                           A8CFF5E30A155A05000A4234 /* LegacyInlineFlowBox.h in Headers */,
</span><ins>+                               BCEA485A097D93020094C9E4 /* LegacyInlineTextBox.h in Headers */,
</ins><span class="cx">                           E4E94D6122FF158A00DD191F /* LegacyLineLayout.h in Headers */,
</span><span class="cx">                          F44A5F591FED38F2007F5944 /* LegacyNSPasteboardTypes.h in Headers */,
</span><span class="cx">                          A185B42A1E8211A100DC9118 /* LegacyPreviewLoader.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformDeferrableTaskh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/DeferrableTask.h (278543 => 278544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/DeferrableTask.h   2021-06-07 04:22:38 UTC (rev 278543)
+++ trunk/Source/WebCore/platform/DeferrableTask.h      2021-06-07 06:16:22 UTC (rev 278544)
</span><span class="lines">@@ -25,7 +25,9 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><del>-#include "GenericTaskQueue.h"
</del><ins>+#include <wtf/Function.h>
+#include <wtf/MainThread.h>
+#include <wtf/WeakPtr.h>
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -55,7 +57,7 @@
</span><span class="cx">         cancelTask();
</span><span class="cx"> 
</span><span class="cx">         m_isPending = true;
</span><del>-        m_dispatcher.postTask([weakThis = makeWeakPtr(*this), task = WTFMove(task)] {
</del><ins>+        callOnMainThread([weakThis = makeWeakPtr(*this), task = WTFMove(task)] {
</ins><span class="cx">             if (!weakThis)
</span><span class="cx">                 return;
</span><span class="cx">             ASSERT(weakThis->isPending());
</span><span class="lines">@@ -65,7 +67,6 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    MainThreadTaskDispatcher m_dispatcher;
</del><span class="cx">     bool m_isPending { false };
</span><span class="cx">     bool m_isClosed { false };
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformGenericTaskQueuecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/GenericTaskQueue.cpp (278543 => 278544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/GenericTaskQueue.cpp       2021-06-07 04:22:38 UTC (rev 278543)
+++ trunk/Source/WebCore/platform/GenericTaskQueue.cpp  2021-06-07 06:16:22 UTC (rev 278544)
</span><span class="lines">@@ -1,100 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "GenericTaskQueue.h"
-
-#include <wtf/Lock.h>
-#include <wtf/MainThread.h>
-#include <wtf/NeverDestroyed.h>
-
-namespace WebCore {
-
-Lock MainThreadTaskDispatcher::s_sharedLock;
-
-MainThreadTaskDispatcher::MainThreadTaskDispatcher()
-{
-}
-
-void MainThreadTaskDispatcher::postTask(Function<void()>&& function)
-{
-    {
-        Locker locker { s_sharedLock };
-        m_pendingTasks.append(WTFMove(function));
-        pendingDispatchers().append(makeWeakPtr(*this));
-    }
-
-    ensureOnMainThread([] {
-        if (!sharedTimer().isActive())
-            sharedTimer().startOneShot(0_s);
-    });
-}
-
-Timer& MainThreadTaskDispatcher::sharedTimer()
-{
-    ASSERT(isMainThread());
-    static NeverDestroyed<Timer> timer([] { MainThreadTaskDispatcher::sharedTimerFired(); });
-    return timer.get();
-}
-
-void MainThreadTaskDispatcher::sharedTimerFired()
-{
-    ASSERT(!sharedTimer().isActive());
-
-    // Copy the pending events first because we don't want to process synchronously the new events
-    // queued by the JS events handlers that are executed in the loop below.
-    Deque<WeakPtr<MainThreadTaskDispatcher>> queuedDispatchers;
-    {
-        Locker locker { s_sharedLock };
-        queuedDispatchers = std::exchange(pendingDispatchers(), { });
-    }
-    while (!queuedDispatchers.isEmpty()) {
-        WeakPtr<MainThreadTaskDispatcher> dispatcher = queuedDispatchers.takeFirst();
-        if (!dispatcher)
-            continue;
-        dispatcher->dispatchOneTask();
-    }
-}
-
-
-Deque<WeakPtr<MainThreadTaskDispatcher>>& MainThreadTaskDispatcher::pendingDispatchers()
-{
-    static NeverDestroyed<Deque<WeakPtr<MainThreadTaskDispatcher>>> dispatchers;
-    return dispatchers.get();
-}
-
-void MainThreadTaskDispatcher::dispatchOneTask()
-{
-    Function<void()> task;
-    {
-        Locker locker { s_sharedLock };
-        ASSERT(!m_pendingTasks.isEmpty());
-        task = m_pendingTasks.takeFirst();
-    }
-    task();
-}
-
-}
-
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformGenericTaskQueueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/GenericTaskQueue.h (278543 => 278544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/GenericTaskQueue.h 2021-06-07 04:22:38 UTC (rev 278543)
+++ trunk/Source/WebCore/platform/GenericTaskQueue.h    2021-06-07 06:16:22 UTC (rev 278544)
</span><span class="lines">@@ -28,36 +28,12 @@
</span><span class="cx"> #include "ContextDestructionObserver.h"
</span><span class="cx"> #include "EventLoop.h"
</span><span class="cx"> #include "ScriptExecutionContext.h"
</span><del>-#include "Timer.h"
-#include <wtf/Deque.h>
</del><span class="cx"> #include <wtf/Function.h>
</span><span class="cx"> #include <wtf/MainThread.h>
</span><del>-#include <wtf/UniqueRef.h>
</del><span class="cx"> #include <wtf/WeakPtr.h>
</span><span class="cx"> 
</span><del>-namespace WTF {
-class Lock;
-}
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class MainThreadTaskDispatcher : public CanMakeWeakPtr<MainThreadTaskDispatcher, WeakPtrFactoryInitialization::Eager> {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    MainThreadTaskDispatcher();
-    void postTask(Function<void()>&&);
-
-private:
-    static Timer& sharedTimer();
-    static void sharedTimerFired();
-    static Deque<WeakPtr<MainThreadTaskDispatcher>>& pendingDispatchers() WTF_REQUIRES_LOCK(s_sharedLock);
-
-    void dispatchOneTask();
-
-    static Lock s_sharedLock;
-    Deque<Function<void()>> m_pendingTasks WTF_GUARDED_BY_LOCK(s_sharedLock);
-};
-
</del><span class="cx"> class TaskQueueBase : public CanMakeWeakPtr<TaskQueueBase> {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="lines">@@ -91,17 +67,10 @@
</span><span class="cx"> class MainThreadTaskQueue : public TaskQueueBase {
</span><span class="cx"> public:
</span><span class="cx">     MainThreadTaskQueue()
</span><del>-        : m_dispatcher(makeUniqueRef<MainThreadTaskDispatcher>())
</del><span class="cx">     {
</span><span class="cx">         ASSERT(isMainThread());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ~MainThreadTaskQueue()
-    {
-        if (!isMainThread())
-            m_dispatcher->postTask([dispatcher = WTFMove(m_dispatcher)] { });
-    }
-
</del><span class="cx">     void enqueueTask(Function<void()>&& task)
</span><span class="cx">     {
</span><span class="cx">         if (isClosed())
</span><span class="lines">@@ -108,7 +77,7 @@
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         incrementPendingTasks();
</span><del>-        m_dispatcher->postTask([weakThis = makeWeakPtr(*this), task = WTFMove(task)] {
</del><ins>+        callOnMainThread([weakThis = makeWeakPtr(*this), task = WTFMove(task)] {
</ins><span class="cx">             if (!weakThis)
</span><span class="cx">                 return;
</span><span class="cx">             weakThis->decrementPendingTasks();
</span><span class="lines">@@ -115,9 +84,6 @@
</span><span class="cx">             task();
</span><span class="cx">         });
</span><span class="cx">     }
</span><del>-
-private:
-    UniqueRef<MainThreadTaskDispatcher> m_dispatcher;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> // Similar to MainThreadTaskQueue but based on the HTML event loop.
</span></span></pre>
</div>
</div>

</body>
</html>