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

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

Issue 2112673003: [DevTools] Move suspended generator location to internal properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments 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/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::Runtime::ExceptionDetails; 28 using blink::protocol::Runtime::ExceptionDetails;
29 using blink::protocol::Debugger::FunctionDetails; 29 using blink::protocol::Debugger::FunctionDetails;
30 using blink::protocol::Debugger::GeneratorObjectDetails;
31 using blink::protocol::Runtime::ScriptId; 30 using blink::protocol::Runtime::ScriptId;
32 using blink::protocol::Runtime::StackTrace; 31 using blink::protocol::Runtime::StackTrace;
33 using blink::protocol::Runtime::RemoteObject; 32 using blink::protocol::Runtime::RemoteObject;
34 33
35 namespace blink { 34 namespace blink {
36 35
37 namespace DebuggerAgentState { 36 namespace DebuggerAgentState {
38 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; 37 static const char javaScriptBreakpoints[] = "javaScriptBreakopints";
39 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; 38 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState";
40 static const char asyncCallStackDepth[] = "asyncCallStackDepth"; 39 static const char asyncCallStackDepth[] = "asyncCallStackDepth";
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 protocol::ErrorSupport errorSupport; 625 protocol::ErrorSupport errorSupport;
627 std::unique_ptr<protocol::Array<protocol::Debugger::Scope>> scopeChain = protocol::Array<protocol::Debugger::Scope>::parse(toProtocolValue(scope.context (), scopes).get(), &errorSupport); 626 std::unique_ptr<protocol::Array<protocol::Debugger::Scope>> scopeChain = protocol::Array<protocol::Debugger::Scope>::parse(toProtocolValue(scope.context (), scopes).get(), &errorSupport);
628 if (hasInternalError(errorString, errorSupport.hasErrors())) 627 if (hasInternalError(errorString, errorSupport.hasErrors()))
629 return; 628 return;
630 functionDetails->setScopeChain(std::move(scopeChain)); 629 functionDetails->setScopeChain(std::move(scopeChain));
631 } 630 }
632 631
633 *details = std::move(functionDetails); 632 *details = std::move(functionDetails);
634 } 633 }
635 634
636 void V8DebuggerAgentImpl::getGeneratorObjectDetails(ErrorString* errorString, co nst String16& objectId, std::unique_ptr<GeneratorObjectDetails>* outDetails)
637 {
638 if (!checkEnabled(errorString))
639 return;
640 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contex tGroupId(), objectId);
641 if (!scope.initialize())
642 return;
643 if (!scope.object()->IsObject()) {
644 *errorString = "Value with given id is not an Object";
645 return;
646 }
647 v8::Local<v8::Object> object = scope.object().As<v8::Object>();
648
649 v8::Local<v8::Object> detailsObject;
650 v8::Local<v8::Value> detailsValue = debugger().generatorObjectDetails(object );
651 if (hasInternalError(errorString, !detailsValue->IsObject() || !detailsValue ->ToObject(scope.context()).ToLocal(&detailsObject)))
652 return;
653
654 if (!scope.injectedScript()->wrapObjectProperty(errorString, detailsObject, toV8StringInternalized(m_isolate, "function"), scope.objectGroupName()))
655 return;
656
657 protocol::ErrorSupport errors;
658 std::unique_ptr<GeneratorObjectDetails> protocolDetails = GeneratorObjectDet ails::parse(toProtocolValue(scope.context(), detailsObject).get(), &errors);
659 if (hasInternalError(errorString, !protocolDetails))
660 return;
661 *outDetails = std::move(protocolDetails);
662 }
663
664 void V8DebuggerAgentImpl::schedulePauseOnNextStatement(const String16& breakReas on, std::unique_ptr<protocol::DictionaryValue> data) 635 void V8DebuggerAgentImpl::schedulePauseOnNextStatement(const String16& breakReas on, std::unique_ptr<protocol::DictionaryValue> data)
665 { 636 {
666 if (!enabled() || m_scheduledDebuggerStep == StepInto || m_javaScriptPauseSc heduled || debugger().isPaused() || !debugger().breakpointsActivated()) 637 if (!enabled() || m_scheduledDebuggerStep == StepInto || m_javaScriptPauseSc heduled || debugger().isPaused() || !debugger().breakpointsActivated())
667 return; 638 return;
668 m_breakReason = breakReason; 639 m_breakReason = breakReason;
669 m_breakAuxData = std::move(data); 640 m_breakAuxData = std::move(data);
670 m_pausingOnNativeEvent = true; 641 m_pausingOnNativeEvent = true;
671 m_skipNextDebuggerStepOut = false; 642 m_skipNextDebuggerStepOut = false;
672 debugger().setPauseOnNextStatement(true); 643 debugger().setPauseOnNextStatement(true);
673 } 644 }
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 { 1213 {
1243 if (!enabled()) 1214 if (!enabled())
1244 return; 1215 return;
1245 m_scheduledDebuggerStep = NoStep; 1216 m_scheduledDebuggerStep = NoStep;
1246 m_scripts.clear(); 1217 m_scripts.clear();
1247 m_blackboxedPositions.clear(); 1218 m_blackboxedPositions.clear();
1248 m_breakpointIdToDebuggerBreakpointIds.clear(); 1219 m_breakpointIdToDebuggerBreakpointIds.clear();
1249 } 1220 }
1250 1221
1251 } // namespace blink 1222 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698