| OLD | NEW |
| 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/DOMNodeIds.h" | 6 #include "core/dom/DOMNodeIds.h" |
| 7 #include "core/dom/Node.h" | |
| 8 #include "platform/heap/Handle.h" | 7 #include "platform/heap/Handle.h" |
| 9 | 8 |
| 10 namespace blink { | 9 namespace blink { |
| 11 | 10 |
| 11 template class WeakIdentifierMap<Node>; |
| 12 |
| 12 #if !ENABLE(OILPAN) | 13 #if !ENABLE(OILPAN) |
| 13 void WeakIdentifierMapTraits<Node>::removedFromIdentifierMap(Node* node) | 14 void WeakIdentifierMapTraits<Node>::removedFromIdentifierMap(Node* node) |
| 14 { | 15 { |
| 15 node->clearFlag(Node::HasWeakReferencesFlag); | 16 node->clearFlag(Node::HasWeakReferencesFlag); |
| 16 } | 17 } |
| 17 | 18 |
| 18 void WeakIdentifierMapTraits<Node>::addedToIdentifierMap(Node* node) | 19 void WeakIdentifierMapTraits<Node>::addedToIdentifierMap(Node* node) |
| 19 { | 20 { |
| 20 node->setFlag(Node::HasWeakReferencesFlag); | 21 node->setFlag(Node::HasWeakReferencesFlag); |
| 21 } | 22 } |
| 22 #endif | 23 #endif |
| 23 | 24 |
| 24 static WeakNodeMap& nodeIds() | 25 static WeakNodeMap& nodeIds() |
| 25 { | 26 { |
| 26 DEFINE_STATIC_LOCAL(RawPtrWillBePersistent<WeakNodeMap>, self, (new WeakNode
Map())); | 27 DEFINE_STATIC_LOCAL(WeakNodeMap::ReferenceType, self, (new WeakNodeMap())); |
| 27 return *self; | 28 return *self; |
| 28 } | 29 } |
| 29 | 30 |
| 30 int DOMNodeIds::idForNode(Node* node) | 31 int DOMNodeIds::idForNode(Node* node) |
| 31 { | 32 { |
| 32 return nodeIds().identifier(node); | 33 return nodeIds().identifier(node); |
| 33 } | 34 } |
| 34 | 35 |
| 35 Node* DOMNodeIds::nodeForId(int id) | 36 Node* DOMNodeIds::nodeForId(int id) |
| 36 { | 37 { |
| 37 return nodeIds().lookup(id); | 38 return nodeIds().lookup(id); |
| 38 } | 39 } |
| 39 | 40 |
| 40 } | 41 } |
| OLD | NEW |