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

Side by Side Diff: Source/core/html/HTMLCollection.cpp

Issue 240273005: Simplify the HTMLCollection destructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix comments Created 6 years, 8 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 | Annotate | Revision Log
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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All r ights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All r ights reserved.
5 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 5 * Copyright (C) 2014 Samsung Electronics. 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 PassRefPtr<HTMLCollection> HTMLCollection::create(ContainerNode& base, Collectio nType type) 169 PassRefPtr<HTMLCollection> HTMLCollection::create(ContainerNode& base, Collectio nType type)
170 { 170 {
171 return adoptRef(new HTMLCollection(base, type, DoesNotOverrideItemAfter)); 171 return adoptRef(new HTMLCollection(base, type, DoesNotOverrideItemAfter));
172 } 172 }
173 173
174 HTMLCollection::~HTMLCollection() 174 HTMLCollection::~HTMLCollection()
175 { 175 {
176 if (hasValidIdNameCache()) 176 if (hasValidIdNameCache())
177 unregisterIdNameCacheFromDocument(document()); 177 unregisterIdNameCacheFromDocument(document());
178 // HTMLNameCollection, ClassCollection and TagCollection remove cache by the mselves. 178 // Named HTMLCollection types remove cache by themselves.
179 if (type() != WindowNamedItems && type() != DocumentNamedItems && type() != ClassCollectionType 179 if (isUnnamedHTMLCollectionType(type()))
180 && type() != HTMLTagCollectionType && type() != TagCollectionType) {
181 ownerNode().nodeLists()->removeCache(this, type()); 180 ownerNode().nodeLists()->removeCache(this, type());
182 }
183 } 181 }
184 182
185 void HTMLCollection::invalidateCache(Document* oldDocument) const 183 void HTMLCollection::invalidateCache(Document* oldDocument) const
186 { 184 {
187 m_collectionIndexCache.invalidate(); 185 m_collectionIndexCache.invalidate();
188 invalidateIdNameCacheMaps(oldDocument); 186 invalidateIdNameCacheMaps(oldDocument);
189 } 187 }
190 188
191 template <class NodeListType> 189 template <class NodeListType>
192 inline bool isMatchingElement(const NodeListType&, const Element&); 190 inline bool isMatchingElement(const NodeListType&, const Element&);
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 507
510 for (unsigned i = 0; nameResults && i < nameResults->size(); ++i) 508 for (unsigned i = 0; nameResults && i < nameResults->size(); ++i)
511 result.append(nameResults->at(i)); 509 result.append(nameResults->at(i));
512 } 510 }
513 511
514 HTMLCollection::NamedItemCache::NamedItemCache() 512 HTMLCollection::NamedItemCache::NamedItemCache()
515 { 513 {
516 } 514 }
517 515
518 } // namespace WebCore 516 } // namespace WebCore
OLDNEW
« Source/core/html/CollectionType.h ('K') | « Source/core/html/CollectionType.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698