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

Side by Side Diff: Source/core/dom/ContainerNode.cpp

Issue 956773003: Oilpan: simplify ContainerNode.removeChildren(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 // Exclude this node when looking for removed focusedElement since only 640 // Exclude this node when looking for removed focusedElement since only
641 // children will be removed. 641 // children will be removed.
642 // This must be later than willRemoveChildren, which might change focus 642 // This must be later than willRemoveChildren, which might change focus
643 // state of a child. 643 // state of a child.
644 document().removeFocusedElementOfSubtree(this, true); 644 document().removeFocusedElementOfSubtree(this, true);
645 645
646 // Removing a node from a selection can cause widget updates. 646 // Removing a node from a selection can cause widget updates.
647 document().nodeChildrenWillBeRemoved(*this); 647 document().nodeChildrenWillBeRemoved(*this);
648 } 648 }
649 649
650 #if !ENABLE(OILPAN)
650 // FIXME: Remove this NodeVector. Right now WebPluginContainerImpl::m_elemen t is a 651 // FIXME: Remove this NodeVector. Right now WebPluginContainerImpl::m_elemen t is a
651 // raw ptr which means the code below can drop the last ref to a plugin elem ent and 652 // raw ptr which means the code below can drop the last ref to a plugin elem ent and
652 // then the code in UpdateSuspendScope::performDeferredWidgetTreeOperations will 653 // then the code in UpdateSuspendScope::performDeferredWidgetTreeOperations will
653 // try to destroy the plugin which will be a use-after-free. We should use a RefPtr 654 // try to destroy the plugin which will be a use-after-free. We should use a RefPtr
654 // in the WebPluginContainerImpl instead. 655 // in the WebPluginContainerImpl instead.
655 NodeVector removedChildren; 656 NodeVector removedChildren;
657 #endif
656 { 658 {
657 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; 659 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
658 660
659 { 661 {
660 EventDispatchForbiddenScope assertNoEventDispatch; 662 EventDispatchForbiddenScope assertNoEventDispatch;
661 ScriptForbiddenScope forbidScript; 663 ScriptForbiddenScope forbidScript;
662 664
665 #if !ENABLE(OILPAN)
663 removedChildren.reserveInitialCapacity(countChildren()); 666 removedChildren.reserveInitialCapacity(countChildren());
664 667 #endif
665 while (RefPtrWillBeRawPtr<Node> child = m_firstChild) { 668 while (RefPtrWillBeRawPtr<Node> child = m_firstChild) {
666 removeBetween(0, child->nextSibling(), *child); 669 removeBetween(0, child->nextSibling(), *child);
670 #if !ENABLE(OILPAN)
667 removedChildren.append(child.get()); 671 removedChildren.append(child.get());
672 #endif
668 notifyNodeRemoved(*child); 673 notifyNodeRemoved(*child);
669 } 674 }
670 } 675 }
671 676
672 ChildrenChange change = {AllChildrenRemoved, nullptr, nullptr, ChildrenC hangeSourceAPI}; 677 ChildrenChange change = {AllChildrenRemoved, nullptr, nullptr, ChildrenC hangeSourceAPI};
673 childrenChanged(change); 678 childrenChanged(change);
674 } 679 }
675 680
676 if (action == DispatchSubtreeModifiedEvent) 681 if (action == DispatchSubtreeModifiedEvent)
677 dispatchSubtreeModifiedEvent(); 682 dispatchSubtreeModifiedEvent();
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 return true; 1477 return true;
1473 1478
1474 if (node->isElementNode() && toElement(node)->shadow()) 1479 if (node->isElementNode() && toElement(node)->shadow())
1475 return true; 1480 return true;
1476 1481
1477 return false; 1482 return false;
1478 } 1483 }
1479 #endif 1484 #endif
1480 1485
1481 } // namespace blink 1486 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698