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

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

Issue 138643003: Simpler return value of HashTable::add/HashMap:add and others (Closed)
Patch Set: Daily master update (now with base url?) Created 6 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 | « Source/core/dom/IdTargetObserverRegistry.cpp ('k') | Source/core/dom/NodeRareData.h » ('j') | 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, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 152
153 switch (node->nodeType()) { 153 switch (node->nodeType()) {
154 case ELEMENT_NODE: { 154 case ELEMENT_NODE: {
155 ++elementNodes; 155 ++elementNodes;
156 156
157 // Tag stats 157 // Tag stats
158 Element* element = toElement(node); 158 Element* element = toElement(node);
159 HashMap<String, size_t>::AddResult result = perTagCount.add(elem ent->tagName(), 1); 159 HashMap<String, size_t>::AddResult result = perTagCount.add(elem ent->tagName(), 1);
160 if (!result.isNewEntry) 160 if (!result.isNewEntry)
161 result.iterator->value++; 161 result.storedValue->value++;
162 162
163 if (ElementData* elementData = element->elementData()) { 163 if (ElementData* elementData = element->elementData()) {
164 attributes += elementData->length(); 164 attributes += elementData->length();
165 ++elementsWithAttributeStorage; 165 ++elementsWithAttributeStorage;
166 for (unsigned i = 0; i < elementData->length(); ++i) { 166 for (unsigned i = 0; i < elementData->length(); ++i) {
167 Attribute* attr = elementData->attributeItem(i); 167 Attribute* attr = elementData->attributeItem(i);
168 if (attr->attr()) 168 if (attr->attr())
169 ++attributesWithAttr; 169 ++attributesWithAttr;
170 } 170 }
171 } 171 }
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 static inline void collectMatchingObserversForMutation(HashMap<MutationObserver* , MutationRecordDeliveryOptions>& observers, Registry* registry, Node* target, M utationObserver::MutationType type, const QualifiedName* attributeName) 2080 static inline void collectMatchingObserversForMutation(HashMap<MutationObserver* , MutationRecordDeliveryOptions>& observers, Registry* registry, Node* target, M utationObserver::MutationType type, const QualifiedName* attributeName)
2081 { 2081 {
2082 if (!registry) 2082 if (!registry)
2083 return; 2083 return;
2084 for (typename Registry::iterator iter = registry->begin(); iter != registry- >end(); ++iter) { 2084 for (typename Registry::iterator iter = registry->begin(); iter != registry- >end(); ++iter) {
2085 const MutationObserverRegistration& registration = **iter; 2085 const MutationObserverRegistration& registration = **iter;
2086 if (registration.shouldReceiveMutationFrom(target, type, attributeName)) { 2086 if (registration.shouldReceiveMutationFrom(target, type, attributeName)) {
2087 MutationRecordDeliveryOptions deliveryOptions = registration.deliver yOptions(); 2087 MutationRecordDeliveryOptions deliveryOptions = registration.deliver yOptions();
2088 HashMap<MutationObserver*, MutationRecordDeliveryOptions>::AddResult result = observers.add(registration.observer(), deliveryOptions); 2088 HashMap<MutationObserver*, MutationRecordDeliveryOptions>::AddResult result = observers.add(registration.observer(), deliveryOptions);
2089 if (!result.isNewEntry) 2089 if (!result.isNewEntry)
2090 result.iterator->value |= deliveryOptions; 2090 result.storedValue->value |= deliveryOptions;
2091 } 2091 }
2092 } 2092 }
2093 } 2093 }
2094 2094
2095 void Node::getRegisteredMutationObserversOfType(HashMap<MutationObserver*, Mutat ionRecordDeliveryOptions>& observers, MutationObserver::MutationType type, const QualifiedName* attributeName) 2095 void Node::getRegisteredMutationObserversOfType(HashMap<MutationObserver*, Mutat ionRecordDeliveryOptions>& observers, MutationObserver::MutationType type, const QualifiedName* attributeName)
2096 { 2096 {
2097 ASSERT((type == MutationObserver::Attributes && attributeName) || !attribute Name); 2097 ASSERT((type == MutationObserver::Attributes && attributeName) || !attribute Name);
2098 collectMatchingObserversForMutation(observers, mutationObserverRegistry(), t his, type, attributeName); 2098 collectMatchingObserversForMutation(observers, mutationObserverRegistry(), t his, type, attributeName);
2099 collectMatchingObserversForMutation(observers, transientMutationObserverRegi stry(), this, type, attributeName); 2099 collectMatchingObserversForMutation(observers, transientMutationObserverRegi stry(), this, type, attributeName);
2100 for (Node* node = parentNode(); node; node = node->parentNode()) { 2100 for (Node* node = parentNode(); node; node = node->parentNode()) {
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
2558 node->showTreeForThis(); 2558 node->showTreeForThis();
2559 } 2559 }
2560 2560
2561 void showNodePath(const WebCore::Node* node) 2561 void showNodePath(const WebCore::Node* node)
2562 { 2562 {
2563 if (node) 2563 if (node)
2564 node->showNodePathForThis(); 2564 node->showNodePathForThis();
2565 } 2565 }
2566 2566
2567 #endif 2567 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/IdTargetObserverRegistry.cpp ('k') | Source/core/dom/NodeRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698