Title: [208829] trunk/Source/WebCore
Revision
208829
Author
[email protected]
Date
2016-11-16 16:59:04 -0800 (Wed, 16 Nov 2016)

Log Message

ScriptExecutionContext::processMessagePortMessagesSoon() should only post task when necessary
https://bugs.webkit.org/show_bug.cgi?id=164812
<rdar://problem/29148465>

Reviewed by Geoffrey Garen.

ScriptExecutionContext::processMessagePortMessagesSoon() should only post task when necessary,
meaning when there is not already one pending.

* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::processMessagePortMessagesSoon):
(WebCore::ScriptExecutionContext::dispatchMessagePortEvents):
* dom/ScriptExecutionContext.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (208828 => 208829)


--- trunk/Source/WebCore/ChangeLog	2016-11-17 00:39:55 UTC (rev 208828)
+++ trunk/Source/WebCore/ChangeLog	2016-11-17 00:59:04 UTC (rev 208829)
@@ -1,5 +1,21 @@
 2016-11-16  Chris Dumez  <[email protected]>
 
+        ScriptExecutionContext::processMessagePortMessagesSoon() should only post task when necessary
+        https://bugs.webkit.org/show_bug.cgi?id=164812
+        <rdar://problem/29148465>
+
+        Reviewed by Geoffrey Garen.
+
+        ScriptExecutionContext::processMessagePortMessagesSoon() should only post task when necessary,
+        meaning when there is not already one pending.
+
+        * dom/ScriptExecutionContext.cpp:
+        (WebCore::ScriptExecutionContext::processMessagePortMessagesSoon):
+        (WebCore::ScriptExecutionContext::dispatchMessagePortEvents):
+        * dom/ScriptExecutionContext.h:
+
+2016-11-16  Chris Dumez  <[email protected]>
+
         Use more references in TreeScope / TreeScopeAdopter
         https://bugs.webkit.org/show_bug.cgi?id=164836
 

Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.cpp (208828 => 208829)


--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp	2016-11-17 00:39:55 UTC (rev 208828)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp	2016-11-17 00:59:04 UTC (rev 208829)
@@ -137,6 +137,10 @@
 
 void ScriptExecutionContext::processMessagePortMessagesSoon()
 {
+    if (m_willProcessMessagePortMessagesSoon)
+        return;
+
+    m_willProcessMessagePortMessagesSoon = true;
     postTask([] (ScriptExecutionContext& context) {
         context.dispatchMessagePortEvents();
     });
@@ -147,6 +151,8 @@
     checkConsistency();
 
     Ref<ScriptExecutionContext> protectedThis(*this);
+    ASSERT(m_willProcessMessagePortMessagesSoon);
+    m_willProcessMessagePortMessagesSoon = false;
 
     // Make a frozen copy of the ports so we can iterate while new ones might be added or destroyed.
     Vector<MessagePort*> possibleMessagePorts;

Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (208828 => 208829)


--- trunk/Source/WebCore/dom/ScriptExecutionContext.h	2016-11-17 00:39:55 UTC (rev 208828)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h	2016-11-17 00:59:04 UTC (rev 208829)
@@ -259,6 +259,7 @@
     RefPtr<DatabaseContext> m_databaseContext;
 
     bool m_activeDOMObjectAdditionForbidden;
+    bool m_willProcessMessagePortMessagesSoon { false };
     int m_timerNestingLevel;
 
 #if !ASSERT_DISABLED
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to