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

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

Issue 1924713002: [DevTools] Removed InjectedScriptHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-inspect-to-native
Patch Set: Created 4 years, 7 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/V8InjectedScriptHost.h" 5 #include "platform/v8_inspector/V8InjectedScriptHost.h"
6 6
7 #include "platform/inspector_protocol/String16.h" 7 #include "platform/inspector_protocol/String16.h"
8 #include "platform/inspector_protocol/Values.h" 8 #include "platform/v8_inspector/InjectedScriptNative.h"
9 #include "platform/v8_inspector/InjectedScript.h"
10 #include "platform/v8_inspector/InjectedScriptHost.h"
11 #include "platform/v8_inspector/InspectorWrapper.h"
12 #include "platform/v8_inspector/JavaScriptCallFrame.h"
13 #include "platform/v8_inspector/V8Compat.h" 9 #include "platform/v8_inspector/V8Compat.h"
14 #include "platform/v8_inspector/V8DebuggerImpl.h" 10 #include "platform/v8_inspector/V8DebuggerImpl.h"
15 #include "platform/v8_inspector/V8StringUtil.h" 11 #include "platform/v8_inspector/V8StringUtil.h"
16 #include "platform/v8_inspector/public/V8DebuggerClient.h" 12 #include "platform/v8_inspector/public/V8DebuggerClient.h"
17 #include "platform/v8_inspector/public/V8EventListenerInfo.h" 13 #include "platform/v8_inspector/public/V8EventListenerInfo.h"
18 #include "platform/v8_inspector/public/V8ToProtocolValue.h"
19 #include <algorithm>
20 14
21 namespace blink { 15 namespace blink {
22 16
23 namespace { 17 namespace {
24 18
25 template<typename CallbackInfo, typename S> 19 void setFunctionProperty(v8::Local<v8::Context> context, v8::Local<v8::Object> o bj, const char* name, v8::FunctionCallback callback, v8::Local<v8::External> ext ernal)
26 inline void v8SetReturnValue(const CallbackInfo& info, const v8::Local<S> handle )
27 { 20 {
28 info.GetReturnValue().Set(handle); 21 v8::Local<v8::String> funcName = toV8StringInternalized(context->GetIsolate( ), name);
22 v8::Local<v8::Function> func;
23 if (!v8::Function::New(context, callback, external).ToLocal(&func))
24 return;
25 func->SetName(funcName);
26 if (!obj->Set(context, funcName, func).FromMaybe(false))
27 return;
29 } 28 }
30 29
31 template<typename CallbackInfo, typename S> 30 V8DebuggerImpl* unwrapDebugger(const v8::FunctionCallbackInfo<v8::Value>& info)
32 inline void v8SetReturnValue(const CallbackInfo& info, v8::MaybeLocal<S> maybe)
33 { 31 {
34 if (LIKELY(!maybe.IsEmpty())) 32 ASSERT(!info.Data().IsEmpty());
35 info.GetReturnValue().Set(maybe.ToLocalChecked()); 33 ASSERT(info.Data()->IsExternal());
34 V8DebuggerImpl* debugger = static_cast<V8DebuggerImpl*>(info.Data().As<v8::E xternal>()->Value());
35 ASSERT(debugger);
36 return debugger;
36 } 37 }
37 38
38 template<typename CallbackInfo> 39 } // namespace
39 inline void v8SetReturnValue(const CallbackInfo& info, bool value) 40
41 v8::Local<v8::Object> V8InjectedScriptHost::create(v8::Local<v8::Context> contex t, V8DebuggerImpl* debugger)
40 { 42 {
41 info.GetReturnValue().Set(value); 43 v8::Isolate* isolate = debugger->isolate();
42 } 44 v8::Local<v8::Object> injectedScriptHost = v8::Object::New(isolate);
43 45 v8::Local<v8::External> debuggerExternal = v8::External::New(isolate, debugg er);
46 setFunctionProperty(context, injectedScriptHost, "internalConstructorName", V8InjectedScriptHost::internalConstructorNameCallback, debuggerExternal);
47 setFunctionProperty(context, injectedScriptHost, "formatAccessorsAsPropertie s", V8InjectedScriptHost::formatAccessorsAsProperties, debuggerExternal);
48 setFunctionProperty(context, injectedScriptHost, "isTypedArray", V8InjectedS criptHost::isTypedArrayCallback, debuggerExternal);
49 setFunctionProperty(context, injectedScriptHost, "subtype", V8InjectedScript Host::subtypeCallback, debuggerExternal);
50 setFunctionProperty(context, injectedScriptHost, "collectionEntries", V8Inje ctedScriptHost::collectionEntriesCallback, debuggerExternal);
51 setFunctionProperty(context, injectedScriptHost, "getInternalProperties", V8 InjectedScriptHost::getInternalPropertiesCallback, debuggerExternal);
52 setFunctionProperty(context, injectedScriptHost, "getEventListeners", V8Inje ctedScriptHost::getEventListenersCallback, debuggerExternal);
53 setFunctionProperty(context, injectedScriptHost, "suppressWarningsAndCallFun ction", V8InjectedScriptHost::suppressWarningsAndCallFunctionCallback, debuggerE xternal);
54 setFunctionProperty(context, injectedScriptHost, "setNonEnumProperty", V8Inj ectedScriptHost::setNonEnumPropertyCallback, debuggerExternal);
55 setFunctionProperty(context, injectedScriptHost, "bind", V8InjectedScriptHos t::bindCallback, debuggerExternal);
56 return injectedScriptHost;
44 } 57 }
45 58
46 void V8InjectedScriptHost::internalConstructorNameCallback(const v8::FunctionCal lbackInfo<v8::Value>& info) 59 void V8InjectedScriptHost::internalConstructorNameCallback(const v8::FunctionCal lbackInfo<v8::Value>& info)
47 { 60 {
48 if (info.Length() < 1 || !info[0]->IsObject()) 61 if (info.Length() < 1 || !info[0]->IsObject())
49 return; 62 return;
50 63
51 v8::Local<v8::Object> object = info[0].As<v8::Object>(); 64 v8::Local<v8::Object> object = info[0].As<v8::Object>();
52 v8::Local<v8::String> result = object->GetConstructorName(); 65 info.GetReturnValue().Set(object->GetConstructorName());
53
54 v8SetReturnValue(info, result);
55 } 66 }
56 67
57 void V8InjectedScriptHost::formatAccessorsAsProperties(const v8::FunctionCallbac kInfo<v8::Value>& info) 68 void V8InjectedScriptHost::formatAccessorsAsProperties(const v8::FunctionCallbac kInfo<v8::Value>& info)
58 { 69 {
59 if (info.Length() < 1) 70 if (info.Length() < 1)
60 return; 71 return;
61 72
62 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G etCurrentContext(), info.Holder()); 73 info.GetReturnValue().Set(unwrapDebugger(info)->client()->formatAccessorsAsP roperties(info[0]));
63 if (!host->debugger())
64 return;
65 v8SetReturnValue(info, host->debugger()->client()->formatAccessorsAsProperti es(info[0]));
66 } 74 }
67 75
68 void V8InjectedScriptHost::isTypedArrayCallback(const v8::FunctionCallbackInfo<v 8::Value>& info) 76 void V8InjectedScriptHost::isTypedArrayCallback(const v8::FunctionCallbackInfo<v 8::Value>& info)
69 { 77 {
70 if (info.Length() < 1) 78 if (info.Length() < 1)
71 return; 79 return;
72 v8SetReturnValue(info, info[0]->IsTypedArray()); 80
81 info.GetReturnValue().Set(info[0]->IsTypedArray());
73 } 82 }
74 83
75 void V8InjectedScriptHost::subtypeCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info) 84 void V8InjectedScriptHost::subtypeCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info)
76 { 85 {
77 if (info.Length() < 1) 86 if (info.Length() < 1)
78 return; 87 return;
88
79 v8::Isolate* isolate = info.GetIsolate(); 89 v8::Isolate* isolate = info.GetIsolate();
80
81 v8::Local<v8::Value> value = info[0]; 90 v8::Local<v8::Value> value = info[0];
82 if (value->IsArray() || value->IsTypedArray() || value->IsArgumentsObject()) { 91 if (value->IsArray() || value->IsTypedArray() || value->IsArgumentsObject()) {
83 v8SetReturnValue(info, toV8StringInternalized(isolate, "array")); 92 info.GetReturnValue().Set(toV8StringInternalized(isolate, "array"));
84 return; 93 return;
85 } 94 }
86 if (value->IsDate()) { 95 if (value->IsDate()) {
87 v8SetReturnValue(info, toV8StringInternalized(isolate, "date")); 96 info.GetReturnValue().Set(toV8StringInternalized(isolate, "date"));
88 return; 97 return;
89 } 98 }
90 if (value->IsRegExp()) { 99 if (value->IsRegExp()) {
91 v8SetReturnValue(info, toV8StringInternalized(isolate, "regexp")); 100 info.GetReturnValue().Set(toV8StringInternalized(isolate, "regexp"));
92 return; 101 return;
93 } 102 }
94 if (value->IsMap() || value->IsWeakMap()) { 103 if (value->IsMap() || value->IsWeakMap()) {
95 v8SetReturnValue(info, toV8StringInternalized(isolate, "map")); 104 info.GetReturnValue().Set(toV8StringInternalized(isolate, "map"));
96 return; 105 return;
97 } 106 }
98 if (value->IsSet() || value->IsWeakSet()) { 107 if (value->IsSet() || value->IsWeakSet()) {
99 v8SetReturnValue(info, toV8StringInternalized(isolate, "set")); 108 info.GetReturnValue().Set(toV8StringInternalized(isolate, "set"));
100 return; 109 return;
101 } 110 }
102 if (value->IsMapIterator() || value->IsSetIterator()) { 111 if (value->IsMapIterator() || value->IsSetIterator()) {
103 v8SetReturnValue(info, toV8StringInternalized(isolate, "iterator")); 112 info.GetReturnValue().Set(toV8StringInternalized(isolate, "iterator"));
104 return; 113 return;
105 } 114 }
106 if (value->IsGeneratorObject()) { 115 if (value->IsGeneratorObject()) {
107 v8SetReturnValue(info, toV8StringInternalized(isolate, "generator")); 116 info.GetReturnValue().Set(toV8StringInternalized(isolate, "generator"));
108 return; 117 return;
109 } 118 }
110 119
111 if (value->IsNativeError()) { 120 if (value->IsNativeError()) {
112 v8SetReturnValue(info, toV8StringInternalized(isolate, "error")); 121 info.GetReturnValue().Set(toV8StringInternalized(isolate, "error"));
113 return; 122 return;
114 } 123 }
115 124 String16 subtype = unwrapDebugger(info)->client()->valueSubtype(value);
116 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G etCurrentContext(), info.Holder());
117 if (!host->debugger())
118 return;
119 String16 subtype = host->debugger()->client()->valueSubtype(value);
120 if (!subtype.isEmpty()) { 125 if (!subtype.isEmpty()) {
121 v8SetReturnValue(info, toV8String(isolate, subtype)); 126 info.GetReturnValue().Set(toV8String(isolate, subtype));
122 return; 127 return;
123 } 128 }
124 } 129 }
125 130
126 void V8InjectedScriptHost::collectionEntriesCallback(const v8::FunctionCallbackI nfo<v8::Value>& info) 131 void V8InjectedScriptHost::collectionEntriesCallback(const v8::FunctionCallbackI nfo<v8::Value>& info)
127 { 132 {
128 if (info.Length() < 1 || !info[0]->IsObject()) 133 if (info.Length() < 1 || !info[0]->IsObject())
129 return; 134 return;
130 135
131 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(info[0]); 136 v8::Local<v8::Object> object = info[0].As<v8::Object>();
132 137 info.GetReturnValue().Set(unwrapDebugger(info)->collectionEntries(object));
133 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G etCurrentContext(), info.Holder());
134 if (!host->debugger())
135 return;
136 v8SetReturnValue(info, host->debugger()->collectionEntries(object));
137 } 138 }
138 139
139 void V8InjectedScriptHost::getInternalPropertiesCallback(const v8::FunctionCallb ackInfo<v8::Value>& info) 140 void V8InjectedScriptHost::getInternalPropertiesCallback(const v8::FunctionCallb ackInfo<v8::Value>& info)
140 { 141 {
141 if (info.Length() < 1 || !info[0]->IsObject()) 142 if (info.Length() < 1 || !info[0]->IsObject())
142 return; 143 return;
143 144
144 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(info[0]); 145 v8::Local<v8::Object> object = info[0].As<v8::Object>();
145 v8::MaybeLocal<v8::Array> properties = v8::Debug::GetInternalProperties(info .GetIsolate(), object); 146 v8::Local<v8::Array> properties;
146 v8SetReturnValue(info, properties); 147 if (v8::Debug::GetInternalProperties(info.GetIsolate(), object).ToLocal(&pro perties))
148 info.GetReturnValue().Set(properties);
147 } 149 }
148 150
149 static v8::Local<v8::Array> wrapListenerFunctions(v8::Isolate* isolate, const V8 EventListenerInfoList& listeners, const String16& type) 151 static v8::Local<v8::Array> wrapListenerFunctions(v8::Isolate* isolate, const V8 EventListenerInfoList& listeners, const String16& type)
150 { 152 {
151 v8::Local<v8::Array> result = v8::Array::New(isolate); 153 v8::Local<v8::Array> result = v8::Array::New(isolate);
152 size_t handlersCount = listeners.size(); 154 size_t handlersCount = listeners.size();
153 for (size_t i = 0, outputIndex = 0; i < handlersCount; ++i) { 155 for (size_t i = 0, outputIndex = 0; i < handlersCount; ++i) {
154 if (listeners[i].eventType != type) 156 if (listeners[i].eventType != type)
155 continue; 157 continue;
156 v8::Local<v8::Object> function = listeners[i].handler; 158 v8::Local<v8::Object> function = listeners[i].handler;
157 v8::Local<v8::Object> listenerEntry = v8::Object::New(isolate); 159 v8::Local<v8::Object> listenerEntry = v8::Object::New(isolate);
158 listenerEntry->Set(toV8StringInternalized(isolate, "listener"), function ); 160 listenerEntry->Set(toV8StringInternalized(isolate, "listener"), function );
159 listenerEntry->Set(toV8StringInternalized(isolate, "useCapture"), v8::Bo olean::New(isolate, listeners[i].useCapture)); 161 listenerEntry->Set(toV8StringInternalized(isolate, "useCapture"), v8::Bo olean::New(isolate, listeners[i].useCapture));
160 listenerEntry->Set(toV8StringInternalized(isolate, "passive"), v8::Boole an::New(isolate, listeners[i].passive)); 162 listenerEntry->Set(toV8StringInternalized(isolate, "passive"), v8::Boole an::New(isolate, listeners[i].passive));
161 result->Set(v8::Number::New(isolate, outputIndex++), listenerEntry); 163 result->Set(v8::Number::New(isolate, outputIndex++), listenerEntry);
162 } 164 }
163 return result; 165 return result;
164 } 166 }
165 167
166 void V8InjectedScriptHost::getEventListenersCallback(const v8::FunctionCallbackI nfo<v8::Value>& info) 168 void V8InjectedScriptHost::getEventListenersCallback(const v8::FunctionCallbackI nfo<v8::Value>& info)
167 { 169 {
168 if (info.Length() < 1) 170 if (info.Length() < 1)
169 return; 171 return;
170 172
171 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G etCurrentContext(), info.Holder()); 173 V8DebuggerClient* client = unwrapDebugger(info)->client();
172 if (!host->debugger())
173 return;
174 V8DebuggerClient* client = host->debugger()->client();
175 V8EventListenerInfoList listenerInfo; 174 V8EventListenerInfoList listenerInfo;
176 client->eventListeners(info[0], listenerInfo); 175 client->eventListeners(info[0], listenerInfo);
177 176
178 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate()); 177 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate());
179 protocol::HashSet<String16> types; 178 protocol::HashSet<String16> types;
180 for (auto& info : listenerInfo) 179 for (auto& info : listenerInfo)
181 types.add(info.eventType); 180 types.add(info.eventType);
182 for (const auto& it : types) { 181 for (const auto& it : types) {
183 v8::Local<v8::Array> listeners = wrapListenerFunctions(info.GetIsolate() , listenerInfo, it.first); 182 v8::Local<v8::Array> listeners = wrapListenerFunctions(info.GetIsolate() , listenerInfo, it.first);
184 if (!listeners->Length()) 183 if (!listeners->Length())
185 continue; 184 continue;
186 result->Set(toV8String(info.GetIsolate(), it.first), listeners); 185 result->Set(toV8String(info.GetIsolate(), it.first), listeners);
187 } 186 }
188 187 info.GetReturnValue().Set(result);
189 v8SetReturnValue(info, result);
190 } 188 }
191 189
192 void V8InjectedScriptHost::callFunctionCallback(const v8::FunctionCallbackInfo<v 8::Value>& info) 190 void V8InjectedScriptHost::suppressWarningsAndCallFunctionCallback(const v8::Fun ctionCallbackInfo<v8::Value>& info)
193 { 191 {
194 if (info.Length() < 2 || info.Length() > 3 || !info[0]->IsFunction()) { 192 if (info.Length() < 2 || info.Length() > 3 || !info[0]->IsFunction()) {
195 ASSERT_NOT_REACHED(); 193 ASSERT_NOT_REACHED();
196 return; 194 return;
197 } 195 }
198 196 if (info.Length() > 2 && (!info[2]->IsArray() && !info[2]->IsUndefined())) {
199 v8::MicrotasksScope microtasks(info.GetIsolate(), v8::MicrotasksScope::kDoNo tRunMicrotasks);
200 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(info[0]);
201 v8::Local<v8::Value> receiver = info[1];
202
203 if (info.Length() < 3 || info[2]->IsUndefined()) {
204 v8::Local<v8::Value> result = function->Call(receiver, 0, 0);
205 v8SetReturnValue(info, result);
206 return;
207 }
208
209 if (!info[2]->IsArray()) {
210 ASSERT_NOT_REACHED(); 197 ASSERT_NOT_REACHED();
211 return; 198 return;
212 } 199 }
213 200
214 v8::Local<v8::Array> arguments = v8::Local<v8::Array>::Cast(info[2]); 201 v8::Isolate* isolate = info.GetIsolate();
215 size_t argc = arguments->Length(); 202 v8::Local<v8::Context> context = isolate->GetCurrentContext();
216 OwnPtr<v8::Local<v8::Value>[]> argv = adoptArrayPtr(new v8::Local<v8::Value> [argc]); 203
217 for (size_t i = 0; i < argc; ++i) { 204 v8::Local<v8::Function> function = info[0].As<v8::Function>();
218 if (!arguments->Get(info.GetIsolate()->GetCurrentContext(), v8::Integer: :New(info.GetIsolate(), i)).ToLocal(&argv[i])) 205 v8::Local<v8::Value> receiver = info[1];
219 return; 206 OwnPtr<v8::Local<v8::Value>[]> argv = nullptr;
207 size_t argc = 0;
208
209 if (info.Length() > 2 && info[2]->IsArray()) {
210 v8::Local<v8::Array> arguments = info[2].As<v8::Array>();
211 argc = arguments->Length();
212 argv = adoptArrayPtr(new v8::Local<v8::Value>[argc]);
213 for (size_t i = 0; i < argc; ++i) {
214 if (!arguments->Get(context, i).ToLocal(&argv[i]))
215 return;
216 }
220 } 217 }
221 218
222 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); 219 V8DebuggerClient* client = unwrapDebugger(info)->client();
223 v8SetReturnValue(info, result); 220 client->muteWarningsAndDeprecations();
224 }
225 221
226 void V8InjectedScriptHost::suppressWarningsAndCallFunctionCallback(const v8::Fun ctionCallbackInfo<v8::Value>& info) 222 v8::MicrotasksScope microtasks(isolate, v8::MicrotasksScope::kDoNotRunMicrot asks);
227 { 223 v8::Local<v8::Value> result;
228 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G etCurrentContext(), info.Holder()); 224 if (function->Call(context, receiver, argc, argv.get()).ToLocal(&result))
229 if (!host->debugger()) 225 info.GetReturnValue().Set(result);
230 return; 226
231 host->debugger()->client()->muteWarningsAndDeprecations(); 227 client->unmuteWarningsAndDeprecations();
232 callFunctionCallback(info);
233 host->debugger()->client()->unmuteWarningsAndDeprecations();
234 } 228 }
235 229
236 void V8InjectedScriptHost::setNonEnumPropertyCallback(const v8::FunctionCallback Info<v8::Value>& info) 230 void V8InjectedScriptHost::setNonEnumPropertyCallback(const v8::FunctionCallback Info<v8::Value>& info)
237 { 231 {
238 if (info.Length() < 3 || !info[0]->IsObject() || !info[1]->IsString()) 232 if (info.Length() < 3 || !info[0]->IsObject() || !info[1]->IsString())
239 return; 233 return;
240 234
241 v8::Local<v8::Object> object = info[0].As<v8::Object>(); 235 v8::Local<v8::Object> object = info[0].As<v8::Object>();
242 v8::Maybe<bool> success = object->DefineOwnProperty(info.GetIsolate()->GetCu rrentContext(), info[1].As<v8::String>(), info[2], v8::DontEnum); 236 v8::Maybe<bool> success = object->DefineOwnProperty(info.GetIsolate()->GetCu rrentContext(), info[1].As<v8::String>(), info[2], v8::DontEnum);
243 ASSERT_UNUSED(!success.IsNothing(), !success.IsNothing()); 237 ASSERT_UNUSED(!success.IsNothing(), !success.IsNothing());
(...skipping 16 matching lines...) Expand all
260 v8::Local<v8::Private> V8Debugger::scopeExtensionPrivate(v8::Isolate* isolate) 254 v8::Local<v8::Private> V8Debugger::scopeExtensionPrivate(v8::Isolate* isolate)
261 { 255 {
262 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Debug ger#scopeExtension")); 256 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Debug ger#scopeExtension"));
263 } 257 }
264 258
265 bool V8Debugger::isRemoteObjectAPIMethod(const String16& name) 259 bool V8Debugger::isRemoteObjectAPIMethod(const String16& name)
266 { 260 {
267 return name == "bindRemoteObject"; 261 return name == "bindRemoteObject";
268 } 262 }
269 263
270 namespace {
271
272 char hiddenPropertyName[] = "v8inspector::InjectedScriptHost";
273 char className[] = "V8InjectedScriptHost";
274 using InjectedScriptHostWrapper = InspectorWrapper<InjectedScriptHost, hiddenPro pertyName, className>;
275
276 const InjectedScriptHostWrapper::V8MethodConfiguration V8InjectedScriptHostMetho ds[] = {
277 {"internalConstructorName", V8InjectedScriptHost::internalConstructorNameCal lback},
278 {"formatAccessorsAsProperties", V8InjectedScriptHost::formatAccessorsAsPrope rties},
279 {"isTypedArray", V8InjectedScriptHost::isTypedArrayCallback},
280 {"subtype", V8InjectedScriptHost::subtypeCallback},
281 {"collectionEntries", V8InjectedScriptHost::collectionEntriesCallback},
282 {"getInternalProperties", V8InjectedScriptHost::getInternalPropertiesCallbac k},
283 {"getEventListeners", V8InjectedScriptHost::getEventListenersCallback},
284 {"callFunction", V8InjectedScriptHost::callFunctionCallback},
285 {"suppressWarningsAndCallFunction", V8InjectedScriptHost::suppressWarningsAn dCallFunctionCallback},
286 {"setNonEnumProperty", V8InjectedScriptHost::setNonEnumPropertyCallback},
287 {"bind", V8InjectedScriptHost::bindCallback}
288 };
289
290 } // namespace
291
292 v8::Local<v8::FunctionTemplate> V8InjectedScriptHost::createWrapperTemplate(v8:: Isolate* isolate)
293 {
294 protocol::Vector<InspectorWrapperBase::V8MethodConfiguration> methods(WTF_AR RAY_LENGTH(V8InjectedScriptHostMethods));
295 std::copy(V8InjectedScriptHostMethods, V8InjectedScriptHostMethods + WTF_ARR AY_LENGTH(V8InjectedScriptHostMethods), methods.begin());
296 protocol::Vector<InspectorWrapperBase::V8AttributeConfiguration> attributes;
297 return InjectedScriptHostWrapper::createWrapperTemplate(isolate, methods, at tributes);
298 }
299
300 v8::Local<v8::Object> V8InjectedScriptHost::wrap(v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, InjectedScriptHost* host)
301 {
302 return InjectedScriptHostWrapper::wrap(constructorTemplate, context, host);
303 }
304
305 InjectedScriptHost* V8InjectedScriptHost::unwrap(v8::Local<v8::Context> context, v8::Local<v8::Object> object)
306 {
307 return InjectedScriptHostWrapper::unwrap(context, object);
308 }
309
310 } // namespace blink 264 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698