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

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

Issue 2122423002: [DevTools] Remove functionDetails from protocol.json (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-generator-details-from-protocol
Patch Set: a 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) 62 v8::Local<v8::Private> V8InjectedScriptHost::internalLocationPrivate(v8::Isolate * isolate)
63 { 63 {
64 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Injec tedScriptHost#internalLocation")); 64 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Injec tedScriptHost#internalLocation"));
65 } 65 }
66 66
67 v8::Local<v8::Private> V8InjectedScriptHost::internalScopesPrivate(v8::Isolate* isolate)
68 {
69 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Injec tedScriptHost#internalScopes"));
70 }
71
72 v8::Local<v8::Private> V8InjectedScriptHost::internalScopePrivate(v8::Isolate* i solate)
73 {
74 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Injec tedScriptHost#internalScope"));
75 }
76
67 void V8InjectedScriptHost::internalConstructorNameCallback(const v8::FunctionCal lbackInfo<v8::Value>& info) 77 void V8InjectedScriptHost::internalConstructorNameCallback(const v8::FunctionCal lbackInfo<v8::Value>& info)
68 { 78 {
69 if (info.Length() < 1 || !info[0]->IsObject()) 79 if (info.Length() < 1 || !info[0]->IsObject())
70 return; 80 return;
71 81
72 v8::Local<v8::Object> object = info[0].As<v8::Object>(); 82 v8::Local<v8::Object> object = info[0].As<v8::Object>();
73 info.GetReturnValue().Set(object->GetConstructorName()); 83 info.GetReturnValue().Set(object->GetConstructorName());
74 } 84 }
75 85
76 void V8InjectedScriptHost::formatAccessorsAsProperties(const v8::FunctionCallbac kInfo<v8::Value>& info) 86 void V8InjectedScriptHost::formatAccessorsAsProperties(const v8::FunctionCallbac kInfo<v8::Value>& info)
(...skipping 16 matching lines...) Expand all
93 info.GetReturnValue().Set(info[0]->IsTypedArray()); 103 info.GetReturnValue().Set(info[0]->IsTypedArray());
94 } 104 }
95 105
96 void V8InjectedScriptHost::subtypeCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info) 106 void V8InjectedScriptHost::subtypeCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info)
97 { 107 {
98 if (info.Length() < 1) 108 if (info.Length() < 1)
99 return; 109 return;
100 110
101 v8::Isolate* isolate = info.GetIsolate(); 111 v8::Isolate* isolate = info.GetIsolate();
102 v8::Local<v8::Value> value = info[0]; 112 v8::Local<v8::Value> value = info[0];
113 if (value->IsObject()) {
114 v8::Local<v8::Object> obj = value.As<v8::Object>();
115 if (obj->HasPrivate(isolate->GetCurrentContext(), internalEntryPrivate(i solate)).FromMaybe(false)) {
116 info.GetReturnValue().Set(toV8StringInternalized(isolate, "internal# entry"));
117 return;
118 }
119 if (obj->HasPrivate(isolate->GetCurrentContext(), internalLocationPrivat e(isolate)).FromMaybe(false)) {
120 info.GetReturnValue().Set(toV8StringInternalized(isolate, "internal# location"));
121 return;
122 }
123 if (obj->HasPrivate(isolate->GetCurrentContext(), internalScopesPrivate( isolate)).FromMaybe(false)) {
124 info.GetReturnValue().Set(toV8StringInternalized(isolate, "internal# scopes"));
125 return;
126 }
127 if (obj->HasPrivate(isolate->GetCurrentContext(), internalScopePrivate(i solate)).FromMaybe(false)) {
128 info.GetReturnValue().Set(toV8StringInternalized(isolate, "internal# scope"));
129 return;
130 }
131 }
103 if (value->IsArray() || value->IsTypedArray() || value->IsArgumentsObject()) { 132 if (value->IsArray() || value->IsTypedArray() || value->IsArgumentsObject()) {
104 info.GetReturnValue().Set(toV8StringInternalized(isolate, "array")); 133 info.GetReturnValue().Set(toV8StringInternalized(isolate, "array"));
105 return; 134 return;
106 } 135 }
107 if (value->IsDate()) { 136 if (value->IsDate()) {
108 info.GetReturnValue().Set(toV8StringInternalized(isolate, "date")); 137 info.GetReturnValue().Set(toV8StringInternalized(isolate, "date"));
109 return; 138 return;
110 } 139 }
111 if (value->IsRegExp()) { 140 if (value->IsRegExp()) {
112 info.GetReturnValue().Set(toV8StringInternalized(isolate, "regexp")); 141 info.GetReturnValue().Set(toV8StringInternalized(isolate, "regexp"));
(...skipping 16 matching lines...) Expand all
129 return; 158 return;
130 } 159 }
131 if (value->IsNativeError()) { 160 if (value->IsNativeError()) {
132 info.GetReturnValue().Set(toV8StringInternalized(isolate, "error")); 161 info.GetReturnValue().Set(toV8StringInternalized(isolate, "error"));
133 return; 162 return;
134 } 163 }
135 if (value->IsProxy()) { 164 if (value->IsProxy()) {
136 info.GetReturnValue().Set(toV8StringInternalized(isolate, "proxy")); 165 info.GetReturnValue().Set(toV8StringInternalized(isolate, "proxy"));
137 return; 166 return;
138 } 167 }
139 if (value->IsObject()) {
140 v8::Local<v8::Object> obj = value.As<v8::Object>();
141 if (obj->HasPrivate(isolate->GetCurrentContext(), internalEntryPrivate(i solate)).FromMaybe(false)) {
142 info.GetReturnValue().Set(toV8StringInternalized(isolate, "internal# entry"));
143 return;
144 }
145 if (obj->HasPrivate(isolate->GetCurrentContext(), internalLocationPrivat e(isolate)).FromMaybe(false)) {
146 info.GetReturnValue().Set(toV8StringInternalized(isolate, "internal# location"));
147 return;
148 }
149 }
150 String16 subtype = unwrapDebugger(info)->client()->valueSubtype(value); 168 String16 subtype = unwrapDebugger(info)->client()->valueSubtype(value);
151 if (!subtype.isEmpty()) { 169 if (!subtype.isEmpty()) {
152 info.GetReturnValue().Set(toV8String(isolate, subtype)); 170 info.GetReturnValue().Set(toV8String(isolate, subtype));
153 return; 171 return;
154 } 172 }
155 } 173 }
156 174
157 void V8InjectedScriptHost::getInternalPropertiesCallback(const v8::FunctionCallb ackInfo<v8::Value>& info) 175 void V8InjectedScriptHost::getInternalPropertiesCallback(const v8::FunctionCallb ackInfo<v8::Value>& info)
158 { 176 {
159 if (info.Length() < 1) 177 if (info.Length() < 1)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 info.GetReturnValue().Set(target); 249 info.GetReturnValue().Set(target);
232 } 250 }
233 251
234 void V8InjectedScriptHost::prototypeCallback(const v8::FunctionCallbackInfo<v8:: Value>& info) 252 void V8InjectedScriptHost::prototypeCallback(const v8::FunctionCallbackInfo<v8:: Value>& info)
235 { 253 {
236 DCHECK(info.Length() > 0 && info[0]->IsObject()); 254 DCHECK(info.Length() > 0 && info[0]->IsObject());
237 info.GetReturnValue().Set(info[0].As<v8::Object>()->GetPrototype()); 255 info.GetReturnValue().Set(info[0].As<v8::Object>()->GetPrototype());
238 } 256 }
239 257
240 } // namespace blink 258 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698