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

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

Issue 2696183002: Migrate WTF::HashSet::remove() to ::erase() [part 1] (Closed)
Patch Set: one more platform-specific reference Created 3 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
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 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after
2335 setSecurityOrigin(SecurityOrigin::createUnique()); 2335 setSecurityOrigin(SecurityOrigin::createUnique());
2336 didUpdateSecurityOrigin(); 2336 didUpdateSecurityOrigin();
2337 } 2337 }
2338 2338
2339 void Document::scheduleUseShadowTreeUpdate(SVGUseElement& element) { 2339 void Document::scheduleUseShadowTreeUpdate(SVGUseElement& element) {
2340 m_useElementsNeedingUpdate.insert(&element); 2340 m_useElementsNeedingUpdate.insert(&element);
2341 scheduleLayoutTreeUpdateIfNeeded(); 2341 scheduleLayoutTreeUpdateIfNeeded();
2342 } 2342 }
2343 2343
2344 void Document::unscheduleUseShadowTreeUpdate(SVGUseElement& element) { 2344 void Document::unscheduleUseShadowTreeUpdate(SVGUseElement& element) {
2345 m_useElementsNeedingUpdate.remove(&element); 2345 m_useElementsNeedingUpdate.erase(&element);
2346 } 2346 }
2347 2347
2348 void Document::updateUseShadowTreesIfNeeded() { 2348 void Document::updateUseShadowTreesIfNeeded() {
2349 ScriptForbiddenScope forbidScript; 2349 ScriptForbiddenScope forbidScript;
2350 2350
2351 if (m_useElementsNeedingUpdate.isEmpty()) 2351 if (m_useElementsNeedingUpdate.isEmpty())
2352 return; 2352 return;
2353 2353
2354 HeapHashSet<Member<SVGUseElement>> elements; 2354 HeapHashSet<Member<SVGUseElement>> elements;
2355 m_useElementsNeedingUpdate.swap(elements); 2355 m_useElementsNeedingUpdate.swap(elements);
(...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after
4168 void Document::registerNodeList(const LiveNodeListBase* list) { 4168 void Document::registerNodeList(const LiveNodeListBase* list) {
4169 DCHECK(!m_nodeLists[list->invalidationType()].contains(list)); 4169 DCHECK(!m_nodeLists[list->invalidationType()].contains(list));
4170 m_nodeLists[list->invalidationType()].insert(list); 4170 m_nodeLists[list->invalidationType()].insert(list);
4171 liveNodeListBaseWriteBarrier(this, list); 4171 liveNodeListBaseWriteBarrier(this, list);
4172 if (list->isRootedAtTreeScope()) 4172 if (list->isRootedAtTreeScope())
4173 m_listsInvalidatedAtDocument.insert(list); 4173 m_listsInvalidatedAtDocument.insert(list);
4174 } 4174 }
4175 4175
4176 void Document::unregisterNodeList(const LiveNodeListBase* list) { 4176 void Document::unregisterNodeList(const LiveNodeListBase* list) {
4177 DCHECK(m_nodeLists[list->invalidationType()].contains(list)); 4177 DCHECK(m_nodeLists[list->invalidationType()].contains(list));
4178 m_nodeLists[list->invalidationType()].remove(list); 4178 m_nodeLists[list->invalidationType()].erase(list);
4179 if (list->isRootedAtTreeScope()) { 4179 if (list->isRootedAtTreeScope()) {
4180 DCHECK(m_listsInvalidatedAtDocument.contains(list)); 4180 DCHECK(m_listsInvalidatedAtDocument.contains(list));
4181 m_listsInvalidatedAtDocument.remove(list); 4181 m_listsInvalidatedAtDocument.erase(list);
4182 } 4182 }
4183 } 4183 }
4184 4184
4185 void Document::registerNodeListWithIdNameCache(const LiveNodeListBase* list) { 4185 void Document::registerNodeListWithIdNameCache(const LiveNodeListBase* list) {
4186 DCHECK(!m_nodeLists[InvalidateOnIdNameAttrChange].contains(list)); 4186 DCHECK(!m_nodeLists[InvalidateOnIdNameAttrChange].contains(list));
4187 m_nodeLists[InvalidateOnIdNameAttrChange].insert(list); 4187 m_nodeLists[InvalidateOnIdNameAttrChange].insert(list);
4188 liveNodeListBaseWriteBarrier(this, list); 4188 liveNodeListBaseWriteBarrier(this, list);
4189 } 4189 }
4190 4190
4191 void Document::unregisterNodeListWithIdNameCache(const LiveNodeListBase* list) { 4191 void Document::unregisterNodeListWithIdNameCache(const LiveNodeListBase* list) {
4192 DCHECK(m_nodeLists[InvalidateOnIdNameAttrChange].contains(list)); 4192 DCHECK(m_nodeLists[InvalidateOnIdNameAttrChange].contains(list));
4193 m_nodeLists[InvalidateOnIdNameAttrChange].remove(list); 4193 m_nodeLists[InvalidateOnIdNameAttrChange].erase(list);
4194 } 4194 }
4195 4195
4196 void Document::attachNodeIterator(NodeIterator* ni) { 4196 void Document::attachNodeIterator(NodeIterator* ni) {
4197 m_nodeIterators.insert(ni); 4197 m_nodeIterators.insert(ni);
4198 } 4198 }
4199 4199
4200 void Document::detachNodeIterator(NodeIterator* ni) { 4200 void Document::detachNodeIterator(NodeIterator* ni) {
4201 // The node iterator can be detached without having been attached if its root 4201 // The node iterator can be detached without having been attached if its root
4202 // node didn't have a document when the iterator was created, but has it now. 4202 // node didn't have a document when the iterator was created, but has it now.
4203 m_nodeIterators.remove(ni); 4203 m_nodeIterators.erase(ni);
4204 } 4204 }
4205 4205
4206 void Document::moveNodeIteratorsToNewDocument(Node& node, 4206 void Document::moveNodeIteratorsToNewDocument(Node& node,
4207 Document& newDocument) { 4207 Document& newDocument) {
4208 HeapHashSet<WeakMember<NodeIterator>> nodeIteratorsList = m_nodeIterators; 4208 HeapHashSet<WeakMember<NodeIterator>> nodeIteratorsList = m_nodeIterators;
4209 for (NodeIterator* ni : nodeIteratorsList) { 4209 for (NodeIterator* ni : nodeIteratorsList) {
4210 if (ni->root() == node) { 4210 if (ni->root() == node) {
4211 detachNodeIterator(ni); 4211 detachNodeIterator(ni);
4212 newDocument.attachNodeIterator(ni); 4212 newDocument.attachNodeIterator(ni);
4213 } 4213 }
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after
5665 } 5665 }
5666 5666
5667 void Document::attachRange(Range* range) { 5667 void Document::attachRange(Range* range) {
5668 DCHECK(!m_ranges.contains(range)); 5668 DCHECK(!m_ranges.contains(range));
5669 m_ranges.insert(range); 5669 m_ranges.insert(range);
5670 } 5670 }
5671 5671
5672 void Document::detachRange(Range* range) { 5672 void Document::detachRange(Range* range) {
5673 // We don't ASSERT m_ranges.contains(range) to allow us to call this 5673 // We don't ASSERT m_ranges.contains(range) to allow us to call this
5674 // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044 5674 // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044
5675 m_ranges.remove(range); 5675 m_ranges.erase(range);
5676 } 5676 }
5677 5677
5678 void Document::initDNSPrefetch() { 5678 void Document::initDNSPrefetch() {
5679 Settings* settings = this->settings(); 5679 Settings* settings = this->settings();
5680 5680
5681 m_haveExplicitlyDisabledDNSPrefetch = false; 5681 m_haveExplicitlyDisabledDNSPrefetch = false;
5682 m_isDNSPrefetchEnabled = settings && settings->getDNSPrefetchingEnabled() && 5682 m_isDNSPrefetchEnabled = settings && settings->getDNSPrefetchingEnabled() &&
5683 getSecurityOrigin()->protocol() == "http"; 5683 getSecurityOrigin()->protocol() == "http";
5684 5684
5685 // Inherit DNS prefetch opt-out from parent frame 5685 // Inherit DNS prefetch opt-out from parent frame
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
6588 } 6588 }
6589 6589
6590 void showLiveDocumentInstances() { 6590 void showLiveDocumentInstances() {
6591 WeakDocumentSet& set = liveDocumentSet(); 6591 WeakDocumentSet& set = liveDocumentSet();
6592 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6592 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6593 for (blink::Document* document : set) 6593 for (blink::Document* document : set)
6594 fprintf(stderr, "- Document %p URL: %s\n", document, 6594 fprintf(stderr, "- Document %p URL: %s\n", document,
6595 document->url().getString().utf8().data()); 6595 document->url().getString().utf8().data());
6596 } 6596 }
6597 #endif 6597 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698