| 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 "sky/engine/config.h" |
| 6 #include "core/inspector/InspectorNodeIds.h" | 6 #include "sky/engine/core/inspector/InspectorNodeIds.h" |
| 7 | 7 |
| 8 #if ENABLE(OILPAN) | 8 #if ENABLE(OILPAN) |
| 9 #include "core/dom/Node.h" | 9 #include "sky/engine/core/dom/Node.h" |
| 10 #else | 10 #else |
| 11 #include "core/dom/WeakNodeMap.h" | 11 #include "sky/engine/core/dom/WeakNodeMap.h" |
| 12 #endif | 12 #endif |
| 13 #include "platform/heap/Handle.h" | 13 #include "sky/engine/platform/heap/Handle.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 static WeakNodeMap& nodeIds() | 17 static WeakNodeMap& nodeIds() |
| 18 { | 18 { |
| 19 DEFINE_STATIC_LOCAL(WeakNodeMap, self, ()); | 19 DEFINE_STATIC_LOCAL(WeakNodeMap, self, ()); |
| 20 return self; | 20 return self; |
| 21 } | 21 } |
| 22 | 22 |
| 23 int InspectorNodeIds::idForNode(Node* node) | 23 int InspectorNodeIds::idForNode(Node* node) |
| 24 { | 24 { |
| 25 static int s_nextNodeId = 1; | 25 static int s_nextNodeId = 1; |
| 26 WeakNodeMap& ids = nodeIds(); | 26 WeakNodeMap& ids = nodeIds(); |
| 27 int result = ids.value(node); | 27 int result = ids.value(node); |
| 28 if (!result) { | 28 if (!result) { |
| 29 result = s_nextNodeId++; | 29 result = s_nextNodeId++; |
| 30 ids.put(node, result); | 30 ids.put(node, result); |
| 31 } | 31 } |
| 32 return result; | 32 return result; |
| 33 } | 33 } |
| 34 | 34 |
| 35 Node* InspectorNodeIds::nodeForId(int id) | 35 Node* InspectorNodeIds::nodeForId(int id) |
| 36 { | 36 { |
| 37 return nodeIds().node(id); | 37 return nodeIds().node(id); |
| 38 } | 38 } |
| 39 | 39 |
| 40 } | 40 } |
| OLD | NEW |