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(impl->client(), wrappe
rTemplate, isolate->GetCurrentContext(), caller.release())); | 27 info.GetReturnValue().Set(V8JavaScriptCallFrame::wrap(wrapperTemplate, isola
te->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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 v8::Local<v8::FunctionTemplate> V8JavaScriptCallFrame::createWrapperTemplate(v8:
:Isolate* isolate) | 172 v8::Local<v8::FunctionTemplate> V8JavaScriptCallFrame::createWrapperTemplate(v8:
:Isolate* isolate) |
173 { | 173 { |
174 protocol::Vector<InspectorWrapperBase::V8MethodConfiguration> methods(WTF_AR
RAY_LENGTH(V8JavaScriptCallFrameMethods)); | 174 protocol::Vector<InspectorWrapperBase::V8MethodConfiguration> methods(WTF_AR
RAY_LENGTH(V8JavaScriptCallFrameMethods)); |
175 std::copy(V8JavaScriptCallFrameMethods, V8JavaScriptCallFrameMethods + WTF_A
RRAY_LENGTH(V8JavaScriptCallFrameMethods), methods.begin()); | 175 std::copy(V8JavaScriptCallFrameMethods, V8JavaScriptCallFrameMethods + WTF_A
RRAY_LENGTH(V8JavaScriptCallFrameMethods), methods.begin()); |
176 protocol::Vector<InspectorWrapperBase::V8AttributeConfiguration> attributes(
WTF_ARRAY_LENGTH(V8JavaScriptCallFrameAttributes)); | 176 protocol::Vector<InspectorWrapperBase::V8AttributeConfiguration> attributes(
WTF_ARRAY_LENGTH(V8JavaScriptCallFrameAttributes)); |
177 std::copy(V8JavaScriptCallFrameAttributes, V8JavaScriptCallFrameAttributes +
WTF_ARRAY_LENGTH(V8JavaScriptCallFrameAttributes), attributes.begin()); | 177 std::copy(V8JavaScriptCallFrameAttributes, V8JavaScriptCallFrameAttributes +
WTF_ARRAY_LENGTH(V8JavaScriptCallFrameAttributes), attributes.begin()); |
178 return JavaScriptCallFrameWrapper::createWrapperTemplate(isolate, methods, a
ttributes); | 178 return JavaScriptCallFrameWrapper::createWrapperTemplate(isolate, methods, a
ttributes); |
179 } | 179 } |
180 | 180 |
181 v8::Local<v8::Object> V8JavaScriptCallFrame::wrap(V8DebuggerClient* client, v8::
Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context,
PassOwnPtr<JavaScriptCallFrame> frame) | 181 v8::Local<v8::Object> V8JavaScriptCallFrame::wrap(v8::Local<v8::FunctionTemplate
> constructorTemplate, v8::Local<v8::Context> context, PassOwnPtr<JavaScriptCall
Frame> frame) |
182 { | 182 { |
183 // Store template for .caller callback | 183 // Store template for .caller callback |
184 frame->setWrapperTemplate(constructorTemplate, context->GetIsolate()); | 184 frame->setWrapperTemplate(constructorTemplate, context->GetIsolate()); |
185 return JavaScriptCallFrameWrapper::wrap(client, constructorTemplate, context
, frame); | 185 return JavaScriptCallFrameWrapper::wrap(constructorTemplate, context, frame)
; |
186 } | 186 } |
187 | 187 |
188 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) |
189 { | 189 { |
190 return JavaScriptCallFrameWrapper::unwrap(context, object); | 190 return JavaScriptCallFrameWrapper::unwrap(context, object); |
191 } | 191 } |
192 | 192 |
193 } // namespace blink | 193 } // namespace blink |
OLD | NEW |