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

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

Issue 365633003: WeakNodeMap should have an ASSERT for node in WeakNodeMap::put() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/dom/WeakNodeMap.h" 6 #include "core/dom/WeakNodeMap.h"
7 7
8 #include "core/dom/Node.h" 8 #include "core/dom/Node.h"
9 9
10 namespace WebCore { 10 namespace WebCore {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 NodeToWeakNodeMaps& allMaps = NodeToWeakNodeMaps::instance(); 63 NodeToWeakNodeMaps& allMaps = NodeToWeakNodeMaps::instance();
64 for (NodeToValue::iterator it = m_nodeToValue.begin(); it != m_nodeToValue.e nd(); ++it) { 64 for (NodeToValue::iterator it = m_nodeToValue.begin(); it != m_nodeToValue.e nd(); ++it) {
65 Node* node = it->key; 65 Node* node = it->key;
66 if (allMaps.removedFromMap(node, this)) 66 if (allMaps.removedFromMap(node, this))
67 node->clearFlag(Node::HasWeakReferencesFlag); 67 node->clearFlag(Node::HasWeakReferencesFlag);
68 } 68 }
69 } 69 }
70 70
71 void WeakNodeMap::put(Node* node, int value) 71 void WeakNodeMap::put(Node* node, int value)
72 { 72 {
73 ASSERT(!m_nodeToValue.contains(node)); 73 ASSERT(node && !m_nodeToValue.contains(node));
74 m_nodeToValue.set(node, value); 74 m_nodeToValue.set(node, value);
75 m_valueToNode.set(value, node); 75 m_valueToNode.set(value, node);
76 76
77 NodeToWeakNodeMaps& maps = NodeToWeakNodeMaps::instance(); 77 NodeToWeakNodeMaps& maps = NodeToWeakNodeMaps::instance();
78 if (maps.addedToMap(node, this)) 78 if (maps.addedToMap(node, this))
79 node->setFlag(Node::HasWeakReferencesFlag); 79 node->setFlag(Node::HasWeakReferencesFlag);
80 } 80 }
81 81
82 int WeakNodeMap::value(Node* node) 82 int WeakNodeMap::value(Node* node)
83 { 83 {
(...skipping 11 matching lines...) Expand all
95 ASSERT(value); 95 ASSERT(value);
96 m_valueToNode.remove(value); 96 m_valueToNode.remove(value);
97 } 97 }
98 98
99 void WeakNodeMap::notifyNodeDestroyed(Node* node) 99 void WeakNodeMap::notifyNodeDestroyed(Node* node)
100 { 100 {
101 NodeToWeakNodeMaps::instance().nodeDestroyed(node); 101 NodeToWeakNodeMaps::instance().nodeDestroyed(node);
102 } 102 }
103 103
104 } 104 }
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