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

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

Issue 2122423002: [DevTools] Remove functionDetails from protocol.json (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-generator-details-from-protocol
Patch Set: a 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;
30 using blink::protocol::Runtime::ScriptId; 29 using blink::protocol::Runtime::ScriptId;
31 using blink::protocol::Runtime::StackTrace; 30 using blink::protocol::Runtime::StackTrace;
32 using blink::protocol::Runtime::RemoteObject; 31 using blink::protocol::Runtime::RemoteObject;
33 32
34 namespace blink { 33 namespace blink {
35 34
36 namespace DebuggerAgentState { 35 namespace DebuggerAgentState {
37 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; 36 static const char javaScriptBreakpoints[] = "javaScriptBreakopints";
38 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; 37 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState";
39 static const char asyncCallStackDepth[] = "asyncCallStackDepth"; 38 static const char asyncCallStackDepth[] = "asyncCallStackDepth";
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 return; 585 return;
587 ScriptsMap::iterator it = m_scripts.find(scriptId); 586 ScriptsMap::iterator it = m_scripts.find(scriptId);
588 if (it == m_scripts.end()) { 587 if (it == m_scripts.end()) {
589 *error = "No script for id: " + scriptId; 588 *error = "No script for id: " + scriptId;
590 return; 589 return;
591 } 590 }
592 v8::HandleScope handles(m_isolate); 591 v8::HandleScope handles(m_isolate);
593 *scriptSource = toProtocolString(it->second->source(m_isolate)); 592 *scriptSource = toProtocolString(it->second->source(m_isolate));
594 } 593 }
595 594
596 void V8DebuggerAgentImpl::getFunctionDetails(ErrorString* errorString, const Str ing16& functionId, std::unique_ptr<FunctionDetails>* details)
597 {
598 if (!checkEnabled(errorString))
599 return;
600 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contex tGroupId(), functionId);
601 if (!scope.initialize())
602 return;
603 if (!scope.object()->IsFunction()) {
604 *errorString = "Value with given id is not a function";
605 return;
606 }
607 v8::Local<v8::Function> function = scope.object().As<v8::Function>();
608
609 v8::Local<v8::Value> scopesValue;
610 v8::Local<v8::Array> scopes;
611 if (m_debugger->functionScopes(function).ToLocal(&scopesValue) && scopesValu e->IsArray()) {
612 scopes = scopesValue.As<v8::Array>();
613 if (!scope.injectedScript()->wrapPropertyInArray(errorString, scopes, to V8StringInternalized(m_isolate, "object"), scope.objectGroupName()))
614 return;
615 }
616
617 std::unique_ptr<FunctionDetails> functionDetails = FunctionDetails::create()
618 .setLocation(buildProtocolLocation(String16::number(function->ScriptId() ), function->GetScriptLineNumber(), function->GetScriptColumnNumber()))
619 .setFunctionName(toProtocolStringWithTypeCheck(function->GetDebugName()) )
620 .setIsGenerator(function->IsGeneratorFunction()).build();
621
622 if (!scopes.IsEmpty()) {
623 protocol::ErrorSupport errorSupport;
624 std::unique_ptr<protocol::Array<protocol::Debugger::Scope>> scopeChain = protocol::Array<protocol::Debugger::Scope>::parse(toProtocolValue(scope.context (), scopes).get(), &errorSupport);
625 if (hasInternalError(errorString, errorSupport.hasErrors()))
626 return;
627 functionDetails->setScopeChain(std::move(scopeChain));
628 }
629
630 *details = std::move(functionDetails);
631 }
632
633 void V8DebuggerAgentImpl::schedulePauseOnNextStatement(const String16& breakReas on, std::unique_ptr<protocol::DictionaryValue> data) 595 void V8DebuggerAgentImpl::schedulePauseOnNextStatement(const String16& breakReas on, std::unique_ptr<protocol::DictionaryValue> data)
634 { 596 {
635 if (!enabled() || m_scheduledDebuggerStep == StepInto || m_javaScriptPauseSc heduled || debugger().isPaused() || !debugger().breakpointsActivated()) 597 if (!enabled() || m_scheduledDebuggerStep == StepInto || m_javaScriptPauseSc heduled || debugger().isPaused() || !debugger().breakpointsActivated())
636 return; 598 return;
637 m_breakReason = breakReason; 599 m_breakReason = breakReason;
638 m_breakAuxData = std::move(data); 600 m_breakAuxData = std::move(data);
639 m_pausingOnNativeEvent = true; 601 m_pausingOnNativeEvent = true;
640 m_skipNextDebuggerStepOut = false; 602 m_skipNextDebuggerStepOut = false;
641 debugger().setPauseOnNextStatement(true); 603 debugger().setPauseOnNextStatement(true);
642 } 604 }
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 { 1176 {
1215 if (!enabled()) 1177 if (!enabled())
1216 return; 1178 return;
1217 m_scheduledDebuggerStep = NoStep; 1179 m_scheduledDebuggerStep = NoStep;
1218 m_scripts.clear(); 1180 m_scripts.clear();
1219 m_blackboxedPositions.clear(); 1181 m_blackboxedPositions.clear();
1220 m_breakpointIdToDebuggerBreakpointIds.clear(); 1182 m_breakpointIdToDebuggerBreakpointIds.clear();
1221 } 1183 }
1222 1184
1223 } // namespace blink 1185 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698