[webkit-changes] [WebKit/WebKit] 527e39: Avoid constructing CSSStyleSheetObservableArray in...
Chris Dumez
noreply at github.com
Wed Mar 15 12:03:31 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 527e395dc858280dd73281765761c52677d1573c
https://github.com/WebKit/WebKit/commit/527e395dc858280dd73281765761c52677d1573c
Author: Chris Dumez <cdumez at apple.com>
Date: 2023-03-15 (Wed, 15 Mar 2023)
Changed paths:
M Source/WebCore/css/CSSStyleSheet.cpp
M Source/WebCore/css/CSSStyleSheet.h
M Source/WebCore/css/CSSStyleSheetObservableArray.cpp
M Source/WebCore/css/CSSStyleSheetObservableArray.h
M Source/WebCore/dom/ShadowRoot.cpp
M Source/WebCore/dom/TreeScope.cpp
M Source/WebCore/dom/TreeScope.h
Log Message:
-----------
Avoid constructing CSSStyleSheetObservableArray in the common case where adoptedStyleSheets is not used
https://bugs.webkit.org/show_bug.cgi?id=253906
Reviewed by Darin Adler.
TreeScope.adoptedStyleSheets is a new feature and not commonly used. The
TreeScope constructor currently spend time constructing a
CSSStyleSheetObservableArray and detaching for it.
We now construct the CSSStyleSheetObservableArray lazily to avoid work in the
constructor. We also drop the work in the destructor as it is no longer
necessary given that CSSStyleSheetObservableArray uses WeakPtrs.
* Source/WebCore/css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::removeAdoptingTreeScope):
* Source/WebCore/css/CSSStyleSheet.h:
* Source/WebCore/css/CSSStyleSheetObservableArray.cpp:
(WebCore::CSSStyleSheetObservableArray::deleteValueAt):
(WebCore::CSSStyleSheetObservableArray::setSheets):
(WebCore::CSSStyleSheetObservableArray::willRemoveSheet):
(WebCore::CSSStyleSheetObservableArray::willDestroyTreeScope): Deleted.
* Source/WebCore/css/CSSStyleSheetObservableArray.h:
* Source/WebCore/dom/TreeScope.cpp:
(WebCore::TreeScope::TreeScope):
(WebCore::TreeScope::ensureAdoptedStyleSheets):
(WebCore::TreeScope::adoptedStyleSheets const):
(WebCore::TreeScope::adoptedStyleSheetWrapper):
(WebCore::TreeScope::setAdoptedStyleSheets):
(WebCore::TreeScope::~TreeScope): Deleted.
* Source/WebCore/dom/TreeScope.h:
Canonical link: https://commits.webkit.org/261702@main
More information about the webkit-changes
mailing list