Chromium Code Reviews| 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/inspector/InspectorNodeIds.h" | 6 #include "core/inspector/InspectorNodeIds.h" |
| 7 | 7 |
| 8 #if ENABLE(OILPAN) | 8 #if ENABLE(OILPAN) |
| 9 #include "core/dom/Node.h" | 9 #include "core/dom/Node.h" |
| 10 #else | 10 #else |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 return *idToNodeMap; | 30 return *idToNodeMap; |
| 31 } | 31 } |
| 32 | 32 |
| 33 int InspectorNodeIds::idForNode(Node* node) | 33 int InspectorNodeIds::idForNode(Node* node) |
| 34 { | 34 { |
| 35 static int s_nextNodeId = 1; | 35 static int s_nextNodeId = 1; |
| 36 NodeToIdMap::iterator it = nodeToIdMap().find(node); | 36 NodeToIdMap::iterator it = nodeToIdMap().find(node); |
| 37 if (it != nodeToIdMap().end()) | 37 if (it != nodeToIdMap().end()) |
| 38 return it->value; | 38 return it->value; |
| 39 int id = s_nextNodeId++; | 39 int id = s_nextNodeId++; |
| 40 it->value = id; | |
|
haraken
2014/07/10 15:14:04
I think this should be replaced with:
nodeToIdM
sof
2014/07/10 15:18:04
Thanks, done.
| |
| 41 ASSERT(idToNodeMap().find(id) == idToNodeMap().end()); | 40 ASSERT(idToNodeMap().find(id) == idToNodeMap().end()); |
| 42 idToNodeMap().set(id, node); | 41 idToNodeMap().set(id, node); |
| 43 return id; | 42 return id; |
| 44 } | 43 } |
| 45 | 44 |
| 46 Node* InspectorNodeIds::nodeForId(int id) | 45 Node* InspectorNodeIds::nodeForId(int id) |
| 47 { | 46 { |
| 48 return idToNodeMap().get(id); | 47 return idToNodeMap().get(id); |
| 49 } | 48 } |
| 50 #else | 49 #else |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 66 return result; | 65 return result; |
| 67 } | 66 } |
| 68 | 67 |
| 69 Node* InspectorNodeIds::nodeForId(int id) | 68 Node* InspectorNodeIds::nodeForId(int id) |
| 70 { | 69 { |
| 71 return nodeIds().node(id); | 70 return nodeIds().node(id); |
| 72 } | 71 } |
| 73 #endif | 72 #endif |
| 74 | 73 |
| 75 } | 74 } |
| OLD | NEW |