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

Side by Side Diff: Source/core/inspector/InspectorNodeIds.cpp

Issue 382633008: Followup to r177831. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update nodeToIdMap 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/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
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; 40 nodeToIdMap().set(node, id);
41 ASSERT(idToNodeMap().find(id) == idToNodeMap().end()); 41 ASSERT(idToNodeMap().find(id) == idToNodeMap().end());
42 idToNodeMap().set(id, node); 42 idToNodeMap().set(id, node);
43 return id; 43 return id;
44 } 44 }
45 45
46 Node* InspectorNodeIds::nodeForId(int id) 46 Node* InspectorNodeIds::nodeForId(int id)
47 { 47 {
48 return idToNodeMap().get(id); 48 return idToNodeMap().get(id);
49 } 49 }
50 #else 50 #else
(...skipping 15 matching lines...) Expand all
66 return result; 66 return result;
67 } 67 }
68 68
69 Node* InspectorNodeIds::nodeForId(int id) 69 Node* InspectorNodeIds::nodeForId(int id)
70 { 70 {
71 return nodeIds().node(id); 71 return nodeIds().node(id);
72 } 72 }
73 #endif 73 #endif
74 74
75 } 75 }
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