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
3 // found in the LICENSE file.
6 #include "core/inspector/InspectorNodeIds.h"
8 #include "core/dom/WeakNodeMap.h"
12 static WeakNodeMap& nodeIds()
14 DEFINE_STATIC_LOCAL(WeakNodeMap, self, ());
18 int InspectorNodeIds::idForNode(Node* node)
20 static int s_nextNodeId = 1;
21 WeakNodeMap& ids = nodeIds();
22 int result = ids.value(node);
24 result = s_nextNodeId++;
25 ids.put(node, result);
30 Node* InspectorNodeIds::nodeForId(int id)
32 return nodeIds().node(id);