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

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

Issue 2102453003: [DevTools] Move collectionEntries to internalProperties in protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/v8_inspector/InjectedScriptNative.h" 8 #include "platform/v8_inspector/InjectedScriptNative.h"
9 #include "platform/v8_inspector/V8Compat.h" 9 #include "platform/v8_inspector/V8Compat.h"
10 #include "platform/v8_inspector/V8DebuggerImpl.h" 10 #include "platform/v8_inspector/V8DebuggerImpl.h"
(...skipping 28 matching lines...) Expand all
39 39
40 v8::Local<v8::Object> V8InjectedScriptHost::create(v8::Local<v8::Context> contex t, V8DebuggerImpl* debugger) 40 v8::Local<v8::Object> V8InjectedScriptHost::create(v8::Local<v8::Context> contex t, V8DebuggerImpl* debugger)
41 { 41 {
42 v8::Isolate* isolate = debugger->isolate(); 42 v8::Isolate* isolate = debugger->isolate();
43 v8::Local<v8::Object> injectedScriptHost = v8::Object::New(isolate); 43 v8::Local<v8::Object> injectedScriptHost = v8::Object::New(isolate);
44 v8::Local<v8::External> debuggerExternal = v8::External::New(isolate, debugg er); 44 v8::Local<v8::External> debuggerExternal = v8::External::New(isolate, debugg er);
45 setFunctionProperty(context, injectedScriptHost, "internalConstructorName", V8InjectedScriptHost::internalConstructorNameCallback, debuggerExternal); 45 setFunctionProperty(context, injectedScriptHost, "internalConstructorName", V8InjectedScriptHost::internalConstructorNameCallback, debuggerExternal);
46 setFunctionProperty(context, injectedScriptHost, "formatAccessorsAsPropertie s", V8InjectedScriptHost::formatAccessorsAsProperties, debuggerExternal); 46 setFunctionProperty(context, injectedScriptHost, "formatAccessorsAsPropertie s", V8InjectedScriptHost::formatAccessorsAsProperties, debuggerExternal);
47 setFunctionProperty(context, injectedScriptHost, "isTypedArray", V8InjectedS criptHost::isTypedArrayCallback, debuggerExternal); 47 setFunctionProperty(context, injectedScriptHost, "isTypedArray", V8InjectedS criptHost::isTypedArrayCallback, debuggerExternal);
48 setFunctionProperty(context, injectedScriptHost, "subtype", V8InjectedScript Host::subtypeCallback, debuggerExternal); 48 setFunctionProperty(context, injectedScriptHost, "subtype", V8InjectedScript Host::subtypeCallback, debuggerExternal);
49 setFunctionProperty(context, injectedScriptHost, "collectionEntries", V8Inje ctedScriptHost::collectionEntriesCallback, debuggerExternal);
50 setFunctionProperty(context, injectedScriptHost, "getInternalProperties", V8 InjectedScriptHost::getInternalPropertiesCallback, debuggerExternal); 49 setFunctionProperty(context, injectedScriptHost, "getInternalProperties", V8 InjectedScriptHost::getInternalPropertiesCallback, debuggerExternal);
51 setFunctionProperty(context, injectedScriptHost, "suppressWarningsAndCallFun ction", V8InjectedScriptHost::suppressWarningsAndCallFunctionCallback, debuggerE xternal); 50 setFunctionProperty(context, injectedScriptHost, "suppressWarningsAndCallFun ction", V8InjectedScriptHost::suppressWarningsAndCallFunctionCallback, debuggerE xternal);
52 setFunctionProperty(context, injectedScriptHost, "bind", V8InjectedScriptHos t::bindCallback, debuggerExternal); 51 setFunctionProperty(context, injectedScriptHost, "bind", V8InjectedScriptHos t::bindCallback, debuggerExternal);
53 setFunctionProperty(context, injectedScriptHost, "proxyTargetValue", V8Injec tedScriptHost::proxyTargetValueCallback, debuggerExternal); 52 setFunctionProperty(context, injectedScriptHost, "proxyTargetValue", V8Injec tedScriptHost::proxyTargetValueCallback, debuggerExternal);
54 setFunctionProperty(context, injectedScriptHost, "prototype", V8InjectedScri ptHost::prototypeCallback, debuggerExternal); 53 setFunctionProperty(context, injectedScriptHost, "prototype", V8InjectedScri ptHost::prototypeCallback, debuggerExternal);
55 return injectedScriptHost; 54 return injectedScriptHost;
56 } 55 }
57 56
57 v8::Local<v8::Private> V8InjectedScriptHost::internalEntryPrivate(v8::Isolate* i solate)
58 {
59 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Injec tedScriptHost#internalEntry"));
60 }
61
58 void V8InjectedScriptHost::internalConstructorNameCallback(const v8::FunctionCal lbackInfo<v8::Value>& info) 62 void V8InjectedScriptHost::internalConstructorNameCallback(const v8::FunctionCal lbackInfo<v8::Value>& info)
59 { 63 {
60 if (info.Length() < 1 || !info[0]->IsObject()) 64 if (info.Length() < 1 || !info[0]->IsObject())
61 return; 65 return;
62 66
63 v8::Local<v8::Object> object = info[0].As<v8::Object>(); 67 v8::Local<v8::Object> object = info[0].As<v8::Object>();
64 info.GetReturnValue().Set(object->GetConstructorName()); 68 info.GetReturnValue().Set(object->GetConstructorName());
65 } 69 }
66 70
67 void V8InjectedScriptHost::formatAccessorsAsProperties(const v8::FunctionCallbac kInfo<v8::Value>& info) 71 void V8InjectedScriptHost::formatAccessorsAsProperties(const v8::FunctionCallbac kInfo<v8::Value>& info)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 129 }
126 if (value->IsProxy()) { 130 if (value->IsProxy()) {
127 info.GetReturnValue().Set(toV8StringInternalized(isolate, "proxy")); 131 info.GetReturnValue().Set(toV8StringInternalized(isolate, "proxy"));
128 return; 132 return;
129 } 133 }
130 String16 subtype = unwrapDebugger(info)->client()->valueSubtype(value); 134 String16 subtype = unwrapDebugger(info)->client()->valueSubtype(value);
131 if (!subtype.isEmpty()) { 135 if (!subtype.isEmpty()) {
132 info.GetReturnValue().Set(toV8String(isolate, subtype)); 136 info.GetReturnValue().Set(toV8String(isolate, subtype));
133 return; 137 return;
134 } 138 }
139 if (value->IsObject() && value.As<v8::Object>()->HasPrivate(isolate->GetCurr entContext(), internalEntryPrivate(isolate)).FromMaybe(false)) {
dgozman 2016/06/28 18:58:09 Let's do this before consulting debugger client.
kozy 2016/06/28 20:55:46 Done.
140 info.GetReturnValue().Set(toV8StringInternalized(isolate, "internal#entr y"));
141 return;
142 }
135 } 143 }
136 144
137 void V8InjectedScriptHost::collectionEntriesCallback(const v8::FunctionCallbackI nfo<v8::Value>& info)
138 {
139 if (info.Length() < 1 || !info[0]->IsObject())
140 return;
141
142 v8::Local<v8::Object> object = info[0].As<v8::Object>();
143 info.GetReturnValue().Set(unwrapDebugger(info)->collectionEntries(object));
144 }
145
146 void V8InjectedScriptHost::getInternalPropertiesCallback(const v8::FunctionCallb ackInfo<v8::Value>& info) 145 void V8InjectedScriptHost::getInternalPropertiesCallback(const v8::FunctionCallb ackInfo<v8::Value>& info)
147 { 146 {
148 if (info.Length() < 1 || !info[0]->IsObject()) 147 if (info.Length() < 1)
149 return; 148 return;
150
151 v8::Local<v8::Object> object = info[0].As<v8::Object>();
152 v8::Local<v8::Array> properties; 149 v8::Local<v8::Array> properties;
153 if (v8::Debug::GetInternalProperties(info.GetIsolate(), object).ToLocal(&pro perties)) 150 if (unwrapDebugger(info)->internalProperties(info.GetIsolate()->GetCurrentCo ntext(), info[0]).ToLocal(&properties))
154 info.GetReturnValue().Set(properties); 151 info.GetReturnValue().Set(properties);
155 } 152 }
156 153
157 void V8InjectedScriptHost::suppressWarningsAndCallFunctionCallback(const v8::Fun ctionCallbackInfo<v8::Value>& info) 154 void V8InjectedScriptHost::suppressWarningsAndCallFunctionCallback(const v8::Fun ctionCallbackInfo<v8::Value>& info)
158 { 155 {
159 if (info.Length() < 2 || info.Length() > 3 || !info[0]->IsFunction()) { 156 if (info.Length() < 2 || info.Length() > 3 || !info[0]->IsFunction()) {
160 NOTREACHED(); 157 NOTREACHED();
161 return; 158 return;
162 } 159 }
163 if (info.Length() > 2 && (!info[2]->IsArray() && !info[2]->IsUndefined())) { 160 if (info.Length() > 2 && (!info[2]->IsArray() && !info[2]->IsUndefined())) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 info.GetReturnValue().Set(target); 217 info.GetReturnValue().Set(target);
221 } 218 }
222 219
223 void V8InjectedScriptHost::prototypeCallback(const v8::FunctionCallbackInfo<v8:: Value>& info) 220 void V8InjectedScriptHost::prototypeCallback(const v8::FunctionCallbackInfo<v8:: Value>& info)
224 { 221 {
225 DCHECK(info.Length() > 0 && info[0]->IsObject()); 222 DCHECK(info.Length() > 0 && info[0]->IsObject());
226 info.GetReturnValue().Set(info[0].As<v8::Object>()->GetPrototype()); 223 info.GetReturnValue().Set(info[0].As<v8::Object>()->GetPrototype());
227 } 224 }
228 225
229 } // namespace blink 226 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698