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

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

Issue 2112673003: [DevTools] Move suspended generator location to internal properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 setFunctionProperty(context, injectedScriptHost, "proxyTargetValue", V8Injec tedScriptHost::proxyTargetValueCallback, debuggerExternal); 52 setFunctionProperty(context, injectedScriptHost, "proxyTargetValue", V8Injec tedScriptHost::proxyTargetValueCallback, debuggerExternal);
53 setFunctionProperty(context, injectedScriptHost, "prototype", V8InjectedScri ptHost::prototypeCallback, debuggerExternal); 53 setFunctionProperty(context, injectedScriptHost, "prototype", V8InjectedScri ptHost::prototypeCallback, debuggerExternal);
54 return injectedScriptHost; 54 return injectedScriptHost;
55 } 55 }
56 56
57 v8::Local<v8::Private> V8InjectedScriptHost::internalEntryPrivate(v8::Isolate* i solate) 57 v8::Local<v8::Private> V8InjectedScriptHost::internalEntryPrivate(v8::Isolate* i solate)
58 { 58 {
59 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Injec tedScriptHost#internalEntry")); 59 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Injec tedScriptHost#internalEntry"));
60 } 60 }
61 61
62 v8::Local<v8::Private> V8InjectedScriptHost::internalLocationPrivate(v8::Isolate * isolate)
63 {
64 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Injec tedScriptHost#internalLocation"));
65 }
66
62 void V8InjectedScriptHost::internalConstructorNameCallback(const v8::FunctionCal lbackInfo<v8::Value>& info) 67 void V8InjectedScriptHost::internalConstructorNameCallback(const v8::FunctionCal lbackInfo<v8::Value>& info)
63 { 68 {
64 if (info.Length() < 1 || !info[0]->IsObject()) 69 if (info.Length() < 1 || !info[0]->IsObject())
65 return; 70 return;
66 71
67 v8::Local<v8::Object> object = info[0].As<v8::Object>(); 72 v8::Local<v8::Object> object = info[0].As<v8::Object>();
68 info.GetReturnValue().Set(object->GetConstructorName()); 73 info.GetReturnValue().Set(object->GetConstructorName());
69 } 74 }
70 75
71 void V8InjectedScriptHost::formatAccessorsAsProperties(const v8::FunctionCallbac kInfo<v8::Value>& info) 76 void V8InjectedScriptHost::formatAccessorsAsProperties(const v8::FunctionCallbac kInfo<v8::Value>& info)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 if (value->IsProxy()) { 135 if (value->IsProxy()) {
131 info.GetReturnValue().Set(toV8StringInternalized(isolate, "proxy")); 136 info.GetReturnValue().Set(toV8StringInternalized(isolate, "proxy"));
132 return; 137 return;
133 } 138 }
134 if (value->IsObject()) { 139 if (value->IsObject()) {
135 v8::Local<v8::Object> obj = value.As<v8::Object>(); 140 v8::Local<v8::Object> obj = value.As<v8::Object>();
136 if (obj->HasPrivate(isolate->GetCurrentContext(), internalEntryPrivate(i solate)).FromMaybe(false)) { 141 if (obj->HasPrivate(isolate->GetCurrentContext(), internalEntryPrivate(i solate)).FromMaybe(false)) {
137 info.GetReturnValue().Set(toV8StringInternalized(isolate, "internal# entry")); 142 info.GetReturnValue().Set(toV8StringInternalized(isolate, "internal# entry"));
138 return; 143 return;
139 } 144 }
145 if (obj->HasPrivate(isolate->GetCurrentContext(), internalLocationPrivat e(isolate)).FromMaybe(false)) {
146 info.GetReturnValue().Set(toV8StringInternalized(isolate, "internal# location"));
147 return;
148 }
140 } 149 }
141 String16 subtype = unwrapDebugger(info)->client()->valueSubtype(value); 150 String16 subtype = unwrapDebugger(info)->client()->valueSubtype(value);
142 if (!subtype.isEmpty()) { 151 if (!subtype.isEmpty()) {
143 info.GetReturnValue().Set(toV8String(isolate, subtype)); 152 info.GetReturnValue().Set(toV8String(isolate, subtype));
144 return; 153 return;
145 } 154 }
146 } 155 }
147 156
148 void V8InjectedScriptHost::getInternalPropertiesCallback(const v8::FunctionCallb ackInfo<v8::Value>& info) 157 void V8InjectedScriptHost::getInternalPropertiesCallback(const v8::FunctionCallb ackInfo<v8::Value>& info)
149 { 158 {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 info.GetReturnValue().Set(target); 231 info.GetReturnValue().Set(target);
223 } 232 }
224 233
225 void V8InjectedScriptHost::prototypeCallback(const v8::FunctionCallbackInfo<v8:: Value>& info) 234 void V8InjectedScriptHost::prototypeCallback(const v8::FunctionCallbackInfo<v8:: Value>& info)
226 { 235 {
227 DCHECK(info.Length() > 0 && info[0]->IsObject()); 236 DCHECK(info.Length() > 0 && info[0]->IsObject());
228 info.GetReturnValue().Set(info[0].As<v8::Object>()->GetPrototype()); 237 info.GetReturnValue().Set(info[0].As<v8::Object>()->GetPrototype());
229 } 238 }
230 239
231 } // namespace blink 240 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698