| OLD | NEW |
| 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/V8JavaScriptCallFrame.h" | 5 #include "platform/v8_inspector/V8JavaScriptCallFrame.h" |
| 6 | 6 |
| 7 #include "platform/v8_inspector/InspectorWrapper.h" | 7 #include "platform/v8_inspector/InspectorWrapper.h" |
| 8 #include "platform/v8_inspector/JavaScriptCallFrame.h" | 8 #include "platform/v8_inspector/JavaScriptCallFrame.h" |
| 9 #include "platform/v8_inspector/V8StringUtil.h" | 9 #include "platform/v8_inspector/V8StringUtil.h" |
| 10 #include "wtf/PassOwnPtr.h" | 10 #include "wtf/PassOwnPtr.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 JavaScriptCallFrame* impl = V8JavaScriptCallFrame::unwrap(info.GetIsolate()-
>GetCurrentContext(), info.Holder()); | 92 JavaScriptCallFrame* impl = V8JavaScriptCallFrame::unwrap(info.GetIsolate()-
>GetCurrentContext(), info.Holder()); |
| 93 info.GetReturnValue().Set(impl->returnValue()); | 93 info.GetReturnValue().Set(impl->returnValue()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void evaluateWithExceptionDetailsMethodCallback(const v8::FunctionCallbackInfo<v
8::Value>& info) | 96 void evaluateWithExceptionDetailsMethodCallback(const v8::FunctionCallbackInfo<v
8::Value>& info) |
| 97 { | 97 { |
| 98 JavaScriptCallFrame* impl = V8JavaScriptCallFrame::unwrap(info.GetIsolate()-
>GetCurrentContext(), info.Holder()); | 98 JavaScriptCallFrame* impl = V8JavaScriptCallFrame::unwrap(info.GetIsolate()-
>GetCurrentContext(), info.Holder()); |
| 99 info.GetReturnValue().Set(impl->evaluateWithExceptionDetails(info[0], info[1
])); | 99 info.GetReturnValue().Set(impl->evaluateWithExceptionDetails(info[0], info[1
])); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void restartMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 103 { | |
| 104 JavaScriptCallFrame* impl = V8JavaScriptCallFrame::unwrap(info.GetIsolate()-
>GetCurrentContext(), info.Holder()); | |
| 105 v8::MaybeLocal<v8::Value> result = impl->restart(); | |
| 106 v8::Local<v8::Value> value; | |
| 107 if (result.ToLocal(&value)) | |
| 108 info.GetReturnValue().Set(value); | |
| 109 } | |
| 110 | |
| 111 void setVariableValueMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | |
| 112 { | |
| 113 JavaScriptCallFrame* impl = V8JavaScriptCallFrame::unwrap(info.GetIsolate()-
>GetCurrentContext(), info.Holder()); | |
| 114 v8::Maybe<int32_t> maybeScopeIndex = info[0]->Int32Value(info.GetIsolate()->
GetCurrentContext()); | |
| 115 if (maybeScopeIndex.IsNothing()) | |
| 116 return; | |
| 117 int scopeIndex = maybeScopeIndex.FromJust(); | |
| 118 v8::MaybeLocal<v8::Value> result = impl->setVariableValue(scopeIndex, info[1
], info[2]); | |
| 119 v8::Local<v8::Value> value; | |
| 120 if (result.ToLocal(&value)) | |
| 121 info.GetReturnValue().Set(value); | |
| 122 | |
| 123 } | |
| 124 | |
| 125 void scopeTypeMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 102 void scopeTypeMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 126 { | 103 { |
| 127 JavaScriptCallFrame* impl = V8JavaScriptCallFrame::unwrap(info.GetIsolate()-
>GetCurrentContext(), info.Holder()); | 104 JavaScriptCallFrame* impl = V8JavaScriptCallFrame::unwrap(info.GetIsolate()-
>GetCurrentContext(), info.Holder()); |
| 128 v8::Maybe<int32_t> maybeScopeIndex = info[0]->Int32Value(info.GetIsolate()->
GetCurrentContext()); | 105 v8::Maybe<int32_t> maybeScopeIndex = info[0]->Int32Value(info.GetIsolate()->
GetCurrentContext()); |
| 129 if (maybeScopeIndex.IsNothing()) | 106 if (maybeScopeIndex.IsNothing()) |
| 130 return; | 107 return; |
| 131 int scopeIndex = maybeScopeIndex.FromJust(); | 108 int scopeIndex = maybeScopeIndex.FromJust(); |
| 132 info.GetReturnValue().Set(impl->scopeType(scopeIndex)); | 109 info.GetReturnValue().Set(impl->scopeType(scopeIndex)); |
| 133 } | 110 } |
| 134 | 111 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 {"column", columnAttributeGetterCallback}, | 154 {"column", columnAttributeGetterCallback}, |
| 178 {"stepInPositions", stepInPositionsAttributeGetterCallback}, | 155 {"stepInPositions", stepInPositionsAttributeGetterCallback}, |
| 179 {"functionName", functionNameAttributeGetterCallback}, | 156 {"functionName", functionNameAttributeGetterCallback}, |
| 180 {"functionLine", functionLineAttributeGetterCallback}, | 157 {"functionLine", functionLineAttributeGetterCallback}, |
| 181 {"functionColumn", functionColumnAttributeGetterCallback}, | 158 {"functionColumn", functionColumnAttributeGetterCallback}, |
| 182 {"isAtReturn", isAtReturnAttributeGetterCallback}, | 159 {"isAtReturn", isAtReturnAttributeGetterCallback}, |
| 183 }; | 160 }; |
| 184 | 161 |
| 185 const JavaScriptCallFrameWrapper::V8MethodConfiguration V8JavaScriptCallFrameMet
hods[] = { | 162 const JavaScriptCallFrameWrapper::V8MethodConfiguration V8JavaScriptCallFrameMet
hods[] = { |
| 186 {"evaluateWithExceptionDetails", evaluateWithExceptionDetailsMethodCallback}
, | 163 {"evaluateWithExceptionDetails", evaluateWithExceptionDetailsMethodCallback}
, |
| 187 {"restart", restartMethodCallback}, | |
| 188 {"setVariableValue", setVariableValueMethodCallback}, | |
| 189 {"scopeType", scopeTypeMethodCallback}, | 164 {"scopeType", scopeTypeMethodCallback}, |
| 190 {"scopeName", scopeNameMethodCallback}, | 165 {"scopeName", scopeNameMethodCallback}, |
| 191 {"scopeStartLocation", scopeStartLocationMethodCallback}, | 166 {"scopeStartLocation", scopeStartLocationMethodCallback}, |
| 192 {"scopeEndLocation", scopeEndLocationMethodCallback}, | 167 {"scopeEndLocation", scopeEndLocationMethodCallback}, |
| 193 }; | 168 }; |
| 194 | 169 |
| 195 } // namespace | 170 } // namespace |
| 196 | 171 |
| 197 v8::Local<v8::FunctionTemplate> V8JavaScriptCallFrame::createWrapperTemplate(v8:
:Isolate* isolate) | 172 v8::Local<v8::FunctionTemplate> V8JavaScriptCallFrame::createWrapperTemplate(v8:
:Isolate* isolate) |
| 198 { | 173 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 209 frame->setWrapperTemplate(constructorTemplate, context->GetIsolate()); | 184 frame->setWrapperTemplate(constructorTemplate, context->GetIsolate()); |
| 210 return JavaScriptCallFrameWrapper::wrap(client, constructorTemplate, context
, frame); | 185 return JavaScriptCallFrameWrapper::wrap(client, constructorTemplate, context
, frame); |
| 211 } | 186 } |
| 212 | 187 |
| 213 JavaScriptCallFrame* V8JavaScriptCallFrame::unwrap(v8::Local<v8::Context> contex
t, v8::Local<v8::Object> object) | 188 JavaScriptCallFrame* V8JavaScriptCallFrame::unwrap(v8::Local<v8::Context> contex
t, v8::Local<v8::Object> object) |
| 214 { | 189 { |
| 215 return JavaScriptCallFrameWrapper::unwrap(context, object); | 190 return JavaScriptCallFrameWrapper::unwrap(context, object); |
| 216 } | 191 } |
| 217 | 192 |
| 218 } // namespace blink | 193 } // namespace blink |
| OLD | NEW |