Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp

Issue 2190693002: [merge to M53] Make sure Widget::dispose() respects UpdateSuspendScope. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
index 2496c66f261334efec6b0f291a0b9107f7e6e9f5..84a18268f1cf2310d1c0416af44c9d3412138b1c 100644
--- a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
@@ -54,6 +54,12 @@ static WidgetSet& widgetsPendingTemporaryRemovalFromParent()
return set;
}
+static WidgetSet& widgetsPendingDispose()
+{
+ DEFINE_STATIC_LOCAL(WidgetSet, set, (new WidgetSet));
+ return set;
+}
+
SubframeLoadingDisabler::SubtreeRootSet& SubframeLoadingDisabler::disabledSubtreeRoots()
{
DEFINE_STATIC_LOCAL(SubtreeRootSet, nodes, (new SubtreeRootSet));
@@ -85,12 +91,22 @@ void HTMLFrameOwnerElement::UpdateSuspendScope::performDeferredWidgetTreeOperati
}
}
- WidgetSet set;
- widgetsPendingTemporaryRemovalFromParent().swap(set);
- for (const auto& widget : set) {
- FrameView* currentParent = toFrameView(widget->parent());
- if (currentParent)
- currentParent->removeChild(widget.get());
+ {
+ WidgetSet set;
+ widgetsPendingTemporaryRemovalFromParent().swap(set);
+ for (const auto& widget : set) {
+ FrameView* currentParent = toFrameView(widget->parent());
+ if (currentParent)
+ currentParent->removeChild(widget.get());
+ }
+ }
+
+ {
+ WidgetSet set;
+ widgetsPendingDispose().swap(set);
+ for (const auto& widget : set) {
+ widget->dispose();
+ }
}
}
@@ -210,6 +226,15 @@ bool HTMLFrameOwnerElement::isKeyboardFocusable() const
return m_contentFrame && HTMLElement::isKeyboardFocusable();
}
+void HTMLFrameOwnerElement::disposeWidgetSoon(Widget* widget)
+{
+ if (s_updateSuspendCount) {
+ widgetsPendingDispose().add(widget);
+ return;
+ }
+ widget->dispose();
+}
+
void HTMLFrameOwnerElement::dispatchLoad()
{
dispatchScopedEvent(Event::create(EventTypeNames::load));
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h ('k') | third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698