| 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" |
| 11 #include <algorithm> | 11 #include <algorithm> |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 void callerAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallba
ckInfo<v8::Value>& info) | 17 void callerAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallba
ckInfo<v8::Value>& info) |
| 18 { | 18 { |
| 19 JavaScriptCallFrame* impl = V8JavaScriptCallFrame::unwrap(info.GetIsolate()-
>GetCurrentContext(), info.Holder()); | 19 JavaScriptCallFrame* impl = V8JavaScriptCallFrame::unwrap(info.GetIsolate()-
>GetCurrentContext(), info.Holder()); |
| 20 OwnPtr<JavaScriptCallFrame> caller = impl->caller(); | 20 OwnPtr<JavaScriptCallFrame> caller = impl->caller(); |
| 21 if (!caller) | 21 if (!caller) |
| 22 return; | 22 return; |
| 23 v8::Isolate* isolate = info.GetIsolate(); | 23 v8::Isolate* isolate = info.GetIsolate(); |
| 24 v8::Local<v8::FunctionTemplate> wrapperTemplate = impl->wrapperTemplate(isol
ate); | 24 v8::Local<v8::FunctionTemplate> wrapperTemplate = impl->wrapperTemplate(isol
ate); |
| 25 if (wrapperTemplate.IsEmpty()) | 25 if (wrapperTemplate.IsEmpty()) |
| 26 return; | 26 return; |
| 27 info.GetReturnValue().Set(V8JavaScriptCallFrame::wrap(wrapperTemplate, isola
te->GetCurrentContext(), caller.release())); | 27 info.GetReturnValue().Set(V8JavaScriptCallFrame::wrap(impl->client(), wrappe
rTemplate, isolate->GetCurrentContext(), caller.release())); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void sourceIDAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCall
backInfo<v8::Value>& info) | 30 void sourceIDAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCall
backInfo<v8::Value>& info) |
| 31 { | 31 { |
| 32 JavaScriptCallFrame* impl = V8JavaScriptCallFrame::unwrap(info.GetIsolate()-
>GetCurrentContext(), info.Holder()); | 32 JavaScriptCallFrame* impl = V8JavaScriptCallFrame::unwrap(info.GetIsolate()-
>GetCurrentContext(), info.Holder()); |
| 33 info.GetReturnValue().Set(impl->sourceID()); | 33 info.GetReturnValue().Set(impl->sourceID()); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void lineAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallback
Info<v8::Value>& info) | 36 void lineAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallback
Info<v8::Value>& info) |
| 37 { | 37 { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 196 |
| 197 v8::Local<v8::FunctionTemplate> V8JavaScriptCallFrame::createWrapperTemplate(v8:
:Isolate* isolate) | 197 v8::Local<v8::FunctionTemplate> V8JavaScriptCallFrame::createWrapperTemplate(v8:
:Isolate* isolate) |
| 198 { | 198 { |
| 199 protocol::Vector<InspectorWrapperBase::V8MethodConfiguration> methods(WTF_AR
RAY_LENGTH(V8JavaScriptCallFrameMethods)); | 199 protocol::Vector<InspectorWrapperBase::V8MethodConfiguration> methods(WTF_AR
RAY_LENGTH(V8JavaScriptCallFrameMethods)); |
| 200 std::copy(V8JavaScriptCallFrameMethods, V8JavaScriptCallFrameMethods + WTF_A
RRAY_LENGTH(V8JavaScriptCallFrameMethods), methods.begin()); | 200 std::copy(V8JavaScriptCallFrameMethods, V8JavaScriptCallFrameMethods + WTF_A
RRAY_LENGTH(V8JavaScriptCallFrameMethods), methods.begin()); |
| 201 protocol::Vector<InspectorWrapperBase::V8AttributeConfiguration> attributes(
WTF_ARRAY_LENGTH(V8JavaScriptCallFrameAttributes)); | 201 protocol::Vector<InspectorWrapperBase::V8AttributeConfiguration> attributes(
WTF_ARRAY_LENGTH(V8JavaScriptCallFrameAttributes)); |
| 202 std::copy(V8JavaScriptCallFrameAttributes, V8JavaScriptCallFrameAttributes +
WTF_ARRAY_LENGTH(V8JavaScriptCallFrameAttributes), attributes.begin()); | 202 std::copy(V8JavaScriptCallFrameAttributes, V8JavaScriptCallFrameAttributes +
WTF_ARRAY_LENGTH(V8JavaScriptCallFrameAttributes), attributes.begin()); |
| 203 return JavaScriptCallFrameWrapper::createWrapperTemplate(isolate, methods, a
ttributes); | 203 return JavaScriptCallFrameWrapper::createWrapperTemplate(isolate, methods, a
ttributes); |
| 204 } | 204 } |
| 205 | 205 |
| 206 v8::Local<v8::Object> V8JavaScriptCallFrame::wrap(v8::Local<v8::FunctionTemplate
> constructorTemplate, v8::Local<v8::Context> context, PassOwnPtr<JavaScriptCall
Frame> frame) | 206 v8::Local<v8::Object> V8JavaScriptCallFrame::wrap(V8DebuggerClient* client, v8::
Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context,
PassOwnPtr<JavaScriptCallFrame> frame) |
| 207 { | 207 { |
| 208 // Store template for .caller callback | 208 // Store template for .caller callback |
| 209 frame->setWrapperTemplate(constructorTemplate, context->GetIsolate()); | 209 frame->setWrapperTemplate(constructorTemplate, context->GetIsolate()); |
| 210 return JavaScriptCallFrameWrapper::wrap(constructorTemplate, context, frame)
; | 210 return JavaScriptCallFrameWrapper::wrap(client, constructorTemplate, context
, frame); |
| 211 } | 211 } |
| 212 | 212 |
| 213 JavaScriptCallFrame* V8JavaScriptCallFrame::unwrap(v8::Local<v8::Context> contex
t, v8::Local<v8::Object> object) | 213 JavaScriptCallFrame* V8JavaScriptCallFrame::unwrap(v8::Local<v8::Context> contex
t, v8::Local<v8::Object> object) |
| 214 { | 214 { |
| 215 return JavaScriptCallFrameWrapper::unwrap(context, object); | 215 return JavaScriptCallFrameWrapper::unwrap(context, object); |
| 216 } | 216 } |
| 217 | 217 |
| 218 } // namespace blink | 218 } // namespace blink |
| OLD | NEW |