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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScriptNative.cpp

Issue 1758313002: DevTools: introduce collections shim to be backed by non-wtf in v8_inspector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "platform/v8_inspector/InjectedScriptNative.h" 5 #include "platform/v8_inspector/InjectedScriptNative.h"
6 6
7 #include "platform/inspector_protocol/Values.h" 7 #include "platform/inspector_protocol/Values.h"
8 #include "wtf/Vector.h"
9 8
10 namespace blink { 9 namespace blink {
11 10
12 InjectedScriptNative::InjectedScriptNative(v8::Isolate* isolate) 11 InjectedScriptNative::InjectedScriptNative(v8::Isolate* isolate)
13 : m_lastBoundObjectId(1) 12 : m_lastBoundObjectId(1)
14 , m_isolate(isolate) 13 , m_isolate(isolate)
15 { 14 {
16 } 15 }
17 16
18 static const char privateKeyName[] = "v8-inspector#injectedScript"; 17 static const char privateKeyName[] = "v8-inspector#injectedScript";
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return m_idToWrappedObject.contains(id) ? m_idToWrappedObject.get(id)->Get(m _isolate) : v8::Local<v8::Value>(); 59 return m_idToWrappedObject.contains(id) ? m_idToWrappedObject.get(id)->Get(m _isolate) : v8::Local<v8::Value>();
61 } 60 }
62 61
63 void InjectedScriptNative::addObjectToGroup(int objectId, const String& groupNam e) 62 void InjectedScriptNative::addObjectToGroup(int objectId, const String& groupNam e)
64 { 63 {
65 if (groupName.isEmpty()) 64 if (groupName.isEmpty())
66 return; 65 return;
67 if (objectId <= 0) 66 if (objectId <= 0)
68 return; 67 return;
69 m_idToObjectGroupName.set(objectId, groupName); 68 m_idToObjectGroupName.set(objectId, groupName);
70 NameToObjectGroup::iterator groupIt = m_nameToObjectGroup.find(groupName); 69 m_nameToObjectGroup.get(groupName).append(objectId);
dgozman 2016/03/04 02:44:05 Restore.
pfeldman 2016/03/04 02:51:10 Done.
71 if (groupIt == m_nameToObjectGroup.end())
72 m_nameToObjectGroup.set(groupName, Vector<int>()).storedValue->value.app end(objectId);
73 else
74 groupIt->value.append(objectId);
75 } 70 }
76 71
77 void InjectedScriptNative::releaseObjectGroup(const String& groupName) 72 void InjectedScriptNative::releaseObjectGroup(const String& groupName)
78 { 73 {
79 if (groupName.isEmpty()) 74 if (groupName.isEmpty())
80 return; 75 return;
81 NameToObjectGroup::iterator groupIt = m_nameToObjectGroup.find(groupName); 76 NameToObjectGroup::iterator groupIt = m_nameToObjectGroup.find(groupName);
82 if (groupIt == m_nameToObjectGroup.end()) 77 if (groupIt == m_nameToObjectGroup.end())
83 return; 78 return;
84 for (int id : groupIt->value) 79 for (int id : *groupIt->second)
85 unbind(id); 80 unbind(id);
86 m_nameToObjectGroup.remove(groupIt); 81 m_nameToObjectGroup.remove(groupName);
87 } 82 }
88 83
89 String InjectedScriptNative::groupName(int objectId) const 84 String InjectedScriptNative::groupName(int objectId) const
90 { 85 {
91 if (objectId <= 0) 86 if (objectId <= 0)
92 return String(); 87 return String();
93 return m_idToObjectGroupName.get(objectId); 88 return m_idToObjectGroupName.get(objectId);
94 } 89 }
95 90
96 } // namespace blink 91 } // namespace blink
97 92
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698