Chromium Code Reviews| 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 cb4ff20343cfe5f88a144054124af3a42c7be321..8bb239a4934d10afccc22cda07aa4e49deaa820a 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) { |
|
esprehn
2016/07/21 06:18:34
braces aren't needed for the loop if you don't wan
|
| + 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)); |