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

Side by Side Diff: src/inspector/injected-script-native.cc

Issue 2523743003: Roll third_party/inspector_protocol to 73028acaa3646789fd2a3bfd0d79eb2d91b696b3 (Closed)
Patch Set: addressed comments Created 4 years, 1 month 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 | « src/inspector/injected-script.cc ('k') | src/inspector/inspector.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project 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 "src/inspector/injected-script-native.h" 5 #include "src/inspector/injected-script-native.h"
6 6
7 namespace v8_inspector { 7 namespace v8_inspector {
8 8
9 InjectedScriptNative::InjectedScriptNative(v8::Isolate* isolate) 9 InjectedScriptNative::InjectedScriptNative(v8::Isolate* isolate)
10 : m_lastBoundObjectId(1), m_isolate(isolate) {} 10 : m_lastBoundObjectId(1), m_isolate(isolate) {}
(...skipping 26 matching lines...) Expand all
37 injectedScriptObject->GetPrivate(context, privateKey).ToLocalChecked(); 37 injectedScriptObject->GetPrivate(context, privateKey).ToLocalChecked();
38 DCHECK(value->IsExternal()); 38 DCHECK(value->IsExternal());
39 v8::Local<v8::External> external = value.As<v8::External>(); 39 v8::Local<v8::External> external = value.As<v8::External>();
40 return static_cast<InjectedScriptNative*>(external->Value()); 40 return static_cast<InjectedScriptNative*>(external->Value());
41 } 41 }
42 42
43 int InjectedScriptNative::bind(v8::Local<v8::Value> value, 43 int InjectedScriptNative::bind(v8::Local<v8::Value> value,
44 const String16& groupName) { 44 const String16& groupName) {
45 if (m_lastBoundObjectId <= 0) m_lastBoundObjectId = 1; 45 if (m_lastBoundObjectId <= 0) m_lastBoundObjectId = 1;
46 int id = m_lastBoundObjectId++; 46 int id = m_lastBoundObjectId++;
47 m_idToWrappedObject[id] = 47 m_idToWrappedObject[id] = std::unique_ptr<v8::Global<v8::Value>>(
48 wrapUnique(new v8::Global<v8::Value>(m_isolate, value)); 48 new v8::Global<v8::Value>(m_isolate, value));
49 addObjectToGroup(id, groupName); 49 addObjectToGroup(id, groupName);
50 return id; 50 return id;
51 } 51 }
52 52
53 void InjectedScriptNative::unbind(int id) { 53 void InjectedScriptNative::unbind(int id) {
54 m_idToWrappedObject.erase(id); 54 m_idToWrappedObject.erase(id);
55 m_idToObjectGroupName.erase(id); 55 m_idToObjectGroupName.erase(id);
56 } 56 }
57 57
58 v8::Local<v8::Value> InjectedScriptNative::objectForId(int id) { 58 v8::Local<v8::Value> InjectedScriptNative::objectForId(int id) {
(...skipping 21 matching lines...) Expand all
80 80
81 String16 InjectedScriptNative::groupName(int objectId) const { 81 String16 InjectedScriptNative::groupName(int objectId) const {
82 if (objectId <= 0) return String16(); 82 if (objectId <= 0) return String16();
83 IdToObjectGroupName::const_iterator iterator = 83 IdToObjectGroupName::const_iterator iterator =
84 m_idToObjectGroupName.find(objectId); 84 m_idToObjectGroupName.find(objectId);
85 return iterator != m_idToObjectGroupName.end() ? iterator->second 85 return iterator != m_idToObjectGroupName.end() ? iterator->second
86 : String16(); 86 : String16();
87 } 87 }
88 88
89 } // namespace v8_inspector 89 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/injected-script.cc ('k') | src/inspector/inspector.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698