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

Side by Side Diff: sky/engine/core/inspector/InspectorNodeIds.cpp

Issue 772563003: Move many of v8_inspector dependencies out of core/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
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 "sky/engine/config.h" 5 #include "sky/engine/config.h"
6 #include "sky/engine/core/inspector/InspectorNodeIds.h" 6 #include "sky/engine/core/inspector/InspectorNodeIds.h"
7 7
8 #if ENABLE(OILPAN)
9 #include "sky/engine/core/dom/Node.h"
10 #else
11 #include "sky/engine/core/dom/WeakNodeMap.h" 8 #include "sky/engine/core/dom/WeakNodeMap.h"
12 #endif
13 #include "sky/engine/platform/heap/Handle.h" 9 #include "sky/engine/platform/heap/Handle.h"
14 10
15 namespace blink { 11 namespace blink {
16 12
17 static WeakNodeMap& nodeIds() 13 static WeakNodeMap& nodeIds()
18 { 14 {
19 DEFINE_STATIC_LOCAL(WeakNodeMap, self, ()); 15 DEFINE_STATIC_LOCAL(WeakNodeMap, self, ());
20 return self; 16 return self;
21 } 17 }
22 18
23 int InspectorNodeIds::idForNode(Node* node) 19 int InspectorNodeIds::idForNode(Node* node)
24 { 20 {
25 static int s_nextNodeId = 1; 21 static int s_nextNodeId = 1;
26 WeakNodeMap& ids = nodeIds(); 22 WeakNodeMap& ids = nodeIds();
27 int result = ids.value(node); 23 int result = ids.value(node);
28 if (!result) { 24 if (!result) {
29 result = s_nextNodeId++; 25 result = s_nextNodeId++;
30 ids.put(node, result); 26 ids.put(node, result);
31 } 27 }
32 return result; 28 return result;
33 } 29 }
34 30
35 Node* InspectorNodeIds::nodeForId(int id) 31 Node* InspectorNodeIds::nodeForId(int id)
36 { 32 {
37 return nodeIds().node(id); 33 return nodeIds().node(id);
38 } 34 }
39 35
40 } 36 }
OLDNEW
« no previous file with comments | « sky/engine/core/inspector/InspectorFrontendChannel.h ('k') | sky/engine/core/inspector/InspectorState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698