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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2039113003: Make removeChild faster with active ranges (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-06T16:21:06 Created 4 years, 6 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
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 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 3751 matching lines...) Expand 10 before | Expand all | Expand 10 after
3762 { 3762 {
3763 HeapHashSet<WeakMember<NodeIterator>> nodeIteratorsList = m_nodeIterators; 3763 HeapHashSet<WeakMember<NodeIterator>> nodeIteratorsList = m_nodeIterators;
3764 for (NodeIterator* ni : nodeIteratorsList) { 3764 for (NodeIterator* ni : nodeIteratorsList) {
3765 if (ni->root() == node) { 3765 if (ni->root() == node) {
3766 detachNodeIterator(ni); 3766 detachNodeIterator(ni);
3767 newDocument.attachNodeIterator(ni); 3767 newDocument.attachNodeIterator(ni);
3768 } 3768 }
3769 } 3769 }
3770 } 3770 }
3771 3771
3772 void Document::updateRangesAfterChildrenChanged(ContainerNode* container)
3773 {
3774 for (Range* range : m_ranges)
3775 range->nodeChildrenChanged(container);
3776 }
3777
3778 void Document::updateRangesAfterNodeMovedToAnotherDocument(const Node& node) 3772 void Document::updateRangesAfterNodeMovedToAnotherDocument(const Node& node)
3779 { 3773 {
3780 DCHECK_NE(node.document(), this); 3774 DCHECK_NE(node.document(), this);
3781 if (m_ranges.isEmpty()) 3775 if (m_ranges.isEmpty())
3782 return; 3776 return;
3783 3777
3784 AttachedRangeSet ranges = m_ranges; 3778 AttachedRangeSet ranges = m_ranges;
3785 for (Range* range : ranges) 3779 for (Range* range : ranges)
3786 range->updateOwnerDocumentIfNeeded(); 3780 range->updateOwnerDocumentIfNeeded();
3787 } 3781 }
(...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after
5999 #ifndef NDEBUG 5993 #ifndef NDEBUG
6000 using namespace blink; 5994 using namespace blink;
6001 void showLiveDocumentInstances() 5995 void showLiveDocumentInstances()
6002 { 5996 {
6003 WeakDocumentSet& set = liveDocumentSet(); 5997 WeakDocumentSet& set = liveDocumentSet();
6004 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5998 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6005 for (Document* document : set) 5999 for (Document* document : set)
6006 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6000 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6007 } 6001 }
6008 #endif 6002 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/Range.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698