Title: [289692] trunk/Source/WebCore
- Revision
- 289692
- Author
- [email protected]
- Date
- 2022-02-12 07:29:06 -0800 (Sat, 12 Feb 2022)
Log Message
Make WidgetHierarchyUpdatesSuspensionScope cheaper if it has nothing to do
https://bugs.webkit.org/show_bug.cgi?id=236486
Reviewed by Simon Fraser.
With content that does a lot of DOM manipulation, we can create and
destroy a WidgetHierarchyUpdatesSuspensionScope on the stack many times.
When this object has nothing to do, it calls an out of line function.
This patch pulls out the check for whether it needs to call
moveWidgets() into the inline destructor.
This is a 1% saving on the jQuery-TodoMVC subtest of Speedometer 2,
though the effect on the top line score is minimal.
* rendering/RenderWidget.cpp:
(WebCore::WidgetHierarchyUpdatesSuspensionScope::moveWidgets):
* rendering/RenderWidget.h:
(WebCore::WidgetHierarchyUpdatesSuspensionScope::~WidgetHierarchyUpdatesSuspensionScope):
(WebCore::WidgetHierarchyUpdatesSuspensionScope::scheduleWidgetToMove):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (289691 => 289692)
--- trunk/Source/WebCore/ChangeLog 2022-02-12 15:08:16 UTC (rev 289691)
+++ trunk/Source/WebCore/ChangeLog 2022-02-12 15:29:06 UTC (rev 289692)
@@ -1,5 +1,27 @@
2022-02-12 Cameron McCormack <[email protected]>
+ Make WidgetHierarchyUpdatesSuspensionScope cheaper if it has nothing to do
+ https://bugs.webkit.org/show_bug.cgi?id=236486
+
+ Reviewed by Simon Fraser.
+
+ With content that does a lot of DOM manipulation, we can create and
+ destroy a WidgetHierarchyUpdatesSuspensionScope on the stack many times.
+ When this object has nothing to do, it calls an out of line function.
+ This patch pulls out the check for whether it needs to call
+ moveWidgets() into the inline destructor.
+
+ This is a 1% saving on the jQuery-TodoMVC subtest of Speedometer 2,
+ though the effect on the top line score is minimal.
+
+ * rendering/RenderWidget.cpp:
+ (WebCore::WidgetHierarchyUpdatesSuspensionScope::moveWidgets):
+ * rendering/RenderWidget.h:
+ (WebCore::WidgetHierarchyUpdatesSuspensionScope::~WidgetHierarchyUpdatesSuspensionScope):
+ (WebCore::WidgetHierarchyUpdatesSuspensionScope::scheduleWidgetToMove):
+
+2022-02-12 Cameron McCormack <[email protected]>
+
Look up InputTypeFactoryMap with an ASCII lowercase string instead of using a ASCIICaseInsensitiveHash
https://bugs.webkit.org/show_bug.cgi?id=236532
Modified: trunk/Source/WebCore/rendering/RenderWidget.cpp (289691 => 289692)
--- trunk/Source/WebCore/rendering/RenderWidget.cpp 2022-02-12 15:08:16 UTC (rev 289691)
+++ trunk/Source/WebCore/rendering/RenderWidget.cpp 2022-02-12 15:29:06 UTC (rev 289692)
@@ -49,6 +49,7 @@
}
unsigned WidgetHierarchyUpdatesSuspensionScope::s_widgetHierarchyUpdateSuspendCount = 0;
+bool WidgetHierarchyUpdatesSuspensionScope::s_haveScheduledWidgetToMove = false;
WidgetHierarchyUpdatesSuspensionScope::WidgetToParentMap& WidgetHierarchyUpdatesSuspensionScope::widgetNewParentMap()
{
@@ -58,6 +59,7 @@
void WidgetHierarchyUpdatesSuspensionScope::moveWidgets()
{
+ ASSERT(s_haveScheduledWidgetToMove);
while (!widgetNewParentMap().isEmpty()) {
auto map = std::exchange(widgetNewParentMap(), { });
for (auto& entry : map) {
@@ -72,6 +74,7 @@
}
}
}
+ s_haveScheduledWidgetToMove = false;
}
static void moveWidgetToParentSoon(Widget& child, FrameView* parent)
Modified: trunk/Source/WebCore/rendering/RenderWidget.h (289691 => 289692)
--- trunk/Source/WebCore/rendering/RenderWidget.h 2022-02-12 15:08:16 UTC (rev 289691)
+++ trunk/Source/WebCore/rendering/RenderWidget.h 2022-02-12 15:29:06 UTC (rev 289692)
@@ -37,13 +37,13 @@
~WidgetHierarchyUpdatesSuspensionScope()
{
ASSERT(s_widgetHierarchyUpdateSuspendCount);
- if (s_widgetHierarchyUpdateSuspendCount == 1)
+ if (s_widgetHierarchyUpdateSuspendCount == 1 && s_haveScheduledWidgetToMove)
moveWidgets();
s_widgetHierarchyUpdateSuspendCount--;
}
static bool isSuspended() { return s_widgetHierarchyUpdateSuspendCount; }
- static void scheduleWidgetToMove(Widget& widget, FrameView* frame) { widgetNewParentMap().set(&widget, frame); }
+ static void scheduleWidgetToMove(Widget&, FrameView*);
private:
using WidgetToParentMap = HashMap<RefPtr<Widget>, FrameView*>;
@@ -51,8 +51,15 @@
WEBCORE_EXPORT void moveWidgets();
WEBCORE_EXPORT static unsigned s_widgetHierarchyUpdateSuspendCount;
+ WEBCORE_EXPORT static bool s_haveScheduledWidgetToMove;
};
-
+
+inline void WidgetHierarchyUpdatesSuspensionScope::scheduleWidgetToMove(Widget& widget, FrameView* frame)
+{
+ s_haveScheduledWidgetToMove = true;
+ widgetNewParentMap().set(&widget, frame);
+}
+
class RenderWidget : public RenderReplaced, private OverlapTestRequestClient {
WTF_MAKE_ISO_ALLOCATED(RenderWidget);
public:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes