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/V8DebuggerAgentImpl.h" | 5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
6 | 6 |
7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
8 #include "platform/inspector_protocol/Values.h" | 8 #include "platform/inspector_protocol/Values.h" |
9 #include "platform/v8_inspector/InjectedScript.h" | 9 #include "platform/v8_inspector/InjectedScript.h" |
10 #include "platform/v8_inspector/InspectedContext.h" | 10 #include "platform/v8_inspector/InspectedContext.h" |
11 #include "platform/v8_inspector/JavaScriptCallFrame.h" | 11 #include "platform/v8_inspector/JavaScriptCallFrame.h" |
12 #include "platform/v8_inspector/RemoteObjectId.h" | 12 #include "platform/v8_inspector/RemoteObjectId.h" |
13 #include "platform/v8_inspector/ScriptBreakpoint.h" | 13 #include "platform/v8_inspector/ScriptBreakpoint.h" |
14 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 14 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
15 #include "platform/v8_inspector/V8Regex.h" | 15 #include "platform/v8_inspector/V8Regex.h" |
16 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" | 16 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" |
17 #include "platform/v8_inspector/V8StackTraceImpl.h" | 17 #include "platform/v8_inspector/V8StackTraceImpl.h" |
18 #include "platform/v8_inspector/V8StringUtil.h" | 18 #include "platform/v8_inspector/V8StringUtil.h" |
19 #include "platform/v8_inspector/public/V8ContentSearchUtil.h" | 19 #include "platform/v8_inspector/public/V8ContentSearchUtil.h" |
20 #include "platform/v8_inspector/public/V8Debugger.h" | 20 #include "platform/v8_inspector/public/V8Debugger.h" |
21 #include "platform/v8_inspector/public/V8DebuggerClient.h" | 21 #include "platform/v8_inspector/public/V8DebuggerClient.h" |
22 #include "platform/v8_inspector/public/V8ToProtocolValue.h" | 22 #include "platform/v8_inspector/public/V8ToProtocolValue.h" |
23 | 23 |
24 using blink::protocol::Array; | 24 using blink::protocol::Array; |
25 using blink::protocol::Maybe; | 25 using blink::protocol::Maybe; |
26 using blink::protocol::Debugger::BreakpointId; | 26 using blink::protocol::Debugger::BreakpointId; |
27 using blink::protocol::Debugger::CallFrame; | 27 using blink::protocol::Debugger::CallFrame; |
28 using blink::protocol::Debugger::CollectionEntry; | |
29 using blink::protocol::Runtime::ExceptionDetails; | 28 using blink::protocol::Runtime::ExceptionDetails; |
30 using blink::protocol::Debugger::FunctionDetails; | 29 using blink::protocol::Debugger::FunctionDetails; |
31 using blink::protocol::Debugger::GeneratorObjectDetails; | 30 using blink::protocol::Debugger::GeneratorObjectDetails; |
32 using blink::protocol::Runtime::ScriptId; | 31 using blink::protocol::Runtime::ScriptId; |
33 using blink::protocol::Runtime::StackTrace; | 32 using blink::protocol::Runtime::StackTrace; |
34 using blink::protocol::Runtime::RemoteObject; | 33 using blink::protocol::Runtime::RemoteObject; |
35 | 34 |
36 namespace blink { | 35 namespace blink { |
37 | 36 |
38 namespace DebuggerAgentState { | 37 namespace DebuggerAgentState { |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 if (!scope.injectedScript()->wrapObjectProperty(errorString, detailsObject,
toV8StringInternalized(m_isolate, "function"), scope.objectGroupName())) | 706 if (!scope.injectedScript()->wrapObjectProperty(errorString, detailsObject,
toV8StringInternalized(m_isolate, "function"), scope.objectGroupName())) |
708 return; | 707 return; |
709 | 708 |
710 protocol::ErrorSupport errors; | 709 protocol::ErrorSupport errors; |
711 std::unique_ptr<GeneratorObjectDetails> protocolDetails = GeneratorObjectDet
ails::parse(toProtocolValue(scope.context(), detailsObject).get(), &errors); | 710 std::unique_ptr<GeneratorObjectDetails> protocolDetails = GeneratorObjectDet
ails::parse(toProtocolValue(scope.context(), detailsObject).get(), &errors); |
712 if (hasInternalError(errorString, !protocolDetails)) | 711 if (hasInternalError(errorString, !protocolDetails)) |
713 return; | 712 return; |
714 *outDetails = std::move(protocolDetails); | 713 *outDetails = std::move(protocolDetails); |
715 } | 714 } |
716 | 715 |
717 void V8DebuggerAgentImpl::getCollectionEntries(ErrorString* errorString, const S
tring16& objectId, std::unique_ptr<protocol::Array<CollectionEntry>>* outEntries
) | |
718 { | |
719 if (!checkEnabled(errorString)) | |
720 return; | |
721 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contex
tGroupId(), objectId); | |
722 if (!scope.initialize()) | |
723 return; | |
724 if (!scope.object()->IsObject()) { | |
725 *errorString = "Object with given id is not a collection"; | |
726 return; | |
727 } | |
728 v8::Local<v8::Object> object = scope.object().As<v8::Object>(); | |
729 | |
730 v8::Local<v8::Value> entriesValue = m_debugger->collectionEntries(object); | |
731 if (hasInternalError(errorString, entriesValue.IsEmpty())) | |
732 return; | |
733 if (entriesValue->IsUndefined()) { | |
734 *errorString = "Object with given id is not a collection"; | |
735 return; | |
736 } | |
737 if (hasInternalError(errorString, !entriesValue->IsArray())) | |
738 return; | |
739 v8::Local<v8::Array> entriesArray = entriesValue.As<v8::Array>(); | |
740 if (!scope.injectedScript()->wrapPropertyInArray(errorString, entriesArray,
toV8StringInternalized(m_isolate, "key"), scope.objectGroupName())) | |
741 return; | |
742 if (!scope.injectedScript()->wrapPropertyInArray(errorString, entriesArray,
toV8StringInternalized(m_isolate, "value"), scope.objectGroupName())) | |
743 return; | |
744 protocol::ErrorSupport errors; | |
745 std::unique_ptr<protocol::Array<CollectionEntry>> entries = protocol::Array<
CollectionEntry>::parse(toProtocolValue(scope.context(), entriesArray).get(), &e
rrors); | |
746 if (hasInternalError(errorString, !entries)) | |
747 return; | |
748 *outEntries = std::move(entries); | |
749 } | |
750 | |
751 void V8DebuggerAgentImpl::schedulePauseOnNextStatement(const String16& breakReas
on, std::unique_ptr<protocol::DictionaryValue> data) | 716 void V8DebuggerAgentImpl::schedulePauseOnNextStatement(const String16& breakReas
on, std::unique_ptr<protocol::DictionaryValue> data) |
752 { | 717 { |
753 if (!enabled() || m_scheduledDebuggerStep == StepInto || m_javaScriptPauseSc
heduled || debugger().isPaused() || !debugger().breakpointsActivated()) | 718 if (!enabled() || m_scheduledDebuggerStep == StepInto || m_javaScriptPauseSc
heduled || debugger().isPaused() || !debugger().breakpointsActivated()) |
754 return; | 719 return; |
755 m_breakReason = breakReason; | 720 m_breakReason = breakReason; |
756 m_breakAuxData = std::move(data); | 721 m_breakAuxData = std::move(data); |
757 m_pausingOnNativeEvent = true; | 722 m_pausingOnNativeEvent = true; |
758 m_skipNextDebuggerStepOut = false; | 723 m_skipNextDebuggerStepOut = false; |
759 debugger().setPauseOnNextStatement(true); | 724 debugger().setPauseOnNextStatement(true); |
760 } | 725 } |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 { | 1297 { |
1333 if (!enabled()) | 1298 if (!enabled()) |
1334 return; | 1299 return; |
1335 m_scheduledDebuggerStep = NoStep; | 1300 m_scheduledDebuggerStep = NoStep; |
1336 m_scripts.clear(); | 1301 m_scripts.clear(); |
1337 m_blackboxedPositions.clear(); | 1302 m_blackboxedPositions.clear(); |
1338 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1303 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1339 } | 1304 } |
1340 | 1305 |
1341 } // namespace blink | 1306 } // namespace blink |
OLD | NEW |