| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010-2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2010-2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 void V8DebuggerImpl::getCompiledScripts(int contextGroupId, protocol::Vector<V8D
ebuggerParsedScript>& result) | 171 void V8DebuggerImpl::getCompiledScripts(int contextGroupId, protocol::Vector<V8D
ebuggerParsedScript>& result) |
| 172 { | 172 { |
| 173 v8::HandleScope scope(m_isolate); | 173 v8::HandleScope scope(m_isolate); |
| 174 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr
otasks); | 174 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr
otasks); |
| 175 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); | 175 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); |
| 176 DCHECK(!debuggerScript->IsUndefined()); | 176 DCHECK(!debuggerScript->IsUndefined()); |
| 177 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(d
ebuggerScript->Get(v8InternalizedString("getScripts"))); | 177 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(d
ebuggerScript->Get(v8InternalizedString("getScripts"))); |
| 178 v8::Local<v8::Value> argv[] = { v8::Integer::New(m_isolate, contextGroupId)
}; | 178 v8::Local<v8::Value> argv[] = { v8::Integer::New(m_isolate, contextGroupId)
}; |
| 179 v8::Local<v8::Value> value; | 179 v8::Local<v8::Value> value; |
| 180 if (!getScriptsFunction->Call(debuggerContext(), debuggerScript, WTF_ARRAY_L
ENGTH(argv), argv).ToLocal(&value)) | 180 if (!getScriptsFunction->Call(debuggerContext(), debuggerScript, PROTOCOL_AR
RAY_LENGTH(argv), argv).ToLocal(&value)) |
| 181 return; | 181 return; |
| 182 DCHECK(value->IsArray()); | 182 DCHECK(value->IsArray()); |
| 183 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value); | 183 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value); |
| 184 result.resize(scriptsArray->Length()); | 184 result.resize(scriptsArray->Length()); |
| 185 for (unsigned i = 0; i < scriptsArray->Length(); ++i) | 185 for (unsigned i = 0; i < scriptsArray->Length(); ++i) |
| 186 result[i] = createParsedScript(v8::Local<v8::Object>::Cast(scriptsArray-
>Get(v8::Integer::New(m_isolate, i))), true); | 186 result[i] = createParsedScript(v8::Local<v8::Object>::Cast(scriptsArray-
>Get(v8::Integer::New(m_isolate, i))), true); |
| 187 } | 187 } |
| 188 | 188 |
| 189 String16 V8DebuggerImpl::setBreakpoint(const String16& sourceID, const ScriptBre
akpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber, bool
interstatementLocation) | 189 String16 V8DebuggerImpl::setBreakpoint(const String16& sourceID, const ScriptBre
akpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber, bool
interstatementLocation) |
| 190 { | 190 { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 JavaScriptCallFrames V8DebuggerImpl::currentCallFrames(int limit) | 423 JavaScriptCallFrames V8DebuggerImpl::currentCallFrames(int limit) |
| 424 { | 424 { |
| 425 if (!m_isolate->InContext()) | 425 if (!m_isolate->InContext()) |
| 426 return JavaScriptCallFrames(); | 426 return JavaScriptCallFrames(); |
| 427 v8::Local<v8::Value> currentCallFramesV8; | 427 v8::Local<v8::Value> currentCallFramesV8; |
| 428 if (m_executionState.IsEmpty()) { | 428 if (m_executionState.IsEmpty()) { |
| 429 v8::Local<v8::Function> currentCallFramesFunction = v8::Local<v8::Functi
on>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCall
Frames"))); | 429 v8::Local<v8::Function> currentCallFramesFunction = v8::Local<v8::Functi
on>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCall
Frames"))); |
| 430 currentCallFramesV8 = v8::Debug::Call(debuggerContext(), currentCallFram
esFunction, v8::Integer::New(m_isolate, limit)).ToLocalChecked(); | 430 currentCallFramesV8 = v8::Debug::Call(debuggerContext(), currentCallFram
esFunction, v8::Integer::New(m_isolate, limit)).ToLocalChecked(); |
| 431 } else { | 431 } else { |
| 432 v8::Local<v8::Value> argv[] = { m_executionState, v8::Integer::New(m_iso
late, limit) }; | 432 v8::Local<v8::Value> argv[] = { m_executionState, v8::Integer::New(m_iso
late, limit) }; |
| 433 currentCallFramesV8 = callDebuggerMethod("currentCallFrames", WTF_ARRAY_
LENGTH(argv), argv).ToLocalChecked(); | 433 currentCallFramesV8 = callDebuggerMethod("currentCallFrames", PROTOCOL_A
RRAY_LENGTH(argv), argv).ToLocalChecked(); |
| 434 } | 434 } |
| 435 DCHECK(!currentCallFramesV8.IsEmpty()); | 435 DCHECK(!currentCallFramesV8.IsEmpty()); |
| 436 if (!currentCallFramesV8->IsArray()) | 436 if (!currentCallFramesV8->IsArray()) |
| 437 return JavaScriptCallFrames(); | 437 return JavaScriptCallFrames(); |
| 438 v8::Local<v8::Array> callFramesArray = currentCallFramesV8.As<v8::Array>(); | 438 v8::Local<v8::Array> callFramesArray = currentCallFramesV8.As<v8::Array>(); |
| 439 JavaScriptCallFrames callFrames; | 439 JavaScriptCallFrames callFrames; |
| 440 for (size_t i = 0; i < callFramesArray->Length(); ++i) { | 440 for (size_t i = 0; i < callFramesArray->Length(); ++i) { |
| 441 v8::Local<v8::Value> callFrameValue; | 441 v8::Local<v8::Value> callFrameValue; |
| 442 if (!callFramesArray->Get(debuggerContext(), i).ToLocal(&callFrameValue)
) | 442 if (!callFramesArray->Get(debuggerContext(), i).ToLocal(&callFrameValue)
) |
| 443 return JavaScriptCallFrames(); | 443 return JavaScriptCallFrames(); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 return v8::Local<v8::Script>(); | 724 return v8::Local<v8::Script>(); |
| 725 return script; | 725 return script; |
| 726 } | 726 } |
| 727 | 727 |
| 728 std::unique_ptr<V8StackTrace> V8DebuggerImpl::createStackTrace(v8::Local<v8::Sta
ckTrace> stackTrace) | 728 std::unique_ptr<V8StackTrace> V8DebuggerImpl::createStackTrace(v8::Local<v8::Sta
ckTrace> stackTrace) |
| 729 { | 729 { |
| 730 V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(m_isolate->GetCurrentC
ontext()); | 730 V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(m_isolate->GetCurrentC
ontext()); |
| 731 return V8StackTraceImpl::create(agent, stackTrace, V8StackTrace::maxCallStac
kSizeToCapture); | 731 return V8StackTraceImpl::create(agent, stackTrace, V8StackTrace::maxCallStac
kSizeToCapture); |
| 732 } | 732 } |
| 733 | 733 |
| 734 std::unique_ptr<V8InspectorSession> V8DebuggerImpl::connect(int contextGroupId,
V8InspectorSessionClient* client, const String16* state) | 734 std::unique_ptr<V8InspectorSession> V8DebuggerImpl::connect(int contextGroupId,
protocol::FrontendChannel* channel, V8InspectorSessionClient* client, const Stri
ng16* state) |
| 735 { | 735 { |
| 736 DCHECK(!m_sessions.contains(contextGroupId)); | 736 DCHECK(!m_sessions.contains(contextGroupId)); |
| 737 std::unique_ptr<V8InspectorSessionImpl> session = V8InspectorSessionImpl::cr
eate(this, contextGroupId, client, state); | 737 std::unique_ptr<V8InspectorSessionImpl> session = V8InspectorSessionImpl::cr
eate(this, contextGroupId, channel, client, state); |
| 738 m_sessions.set(contextGroupId, session.get()); | 738 m_sessions.set(contextGroupId, session.get()); |
| 739 return std::move(session); | 739 return std::move(session); |
| 740 } | 740 } |
| 741 | 741 |
| 742 void V8DebuggerImpl::disconnect(V8InspectorSessionImpl* session) | 742 void V8DebuggerImpl::disconnect(V8InspectorSessionImpl* session) |
| 743 { | 743 { |
| 744 DCHECK(m_sessions.contains(session->contextGroupId())); | 744 DCHECK(m_sessions.contains(session->contextGroupId())); |
| 745 m_sessions.remove(session->contextGroupId()); | 745 m_sessions.remove(session->contextGroupId()); |
| 746 } | 746 } |
| 747 | 747 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 return nullptr; | 840 return nullptr; |
| 841 return m_contexts.get(contextGroupId); | 841 return m_contexts.get(contextGroupId); |
| 842 } | 842 } |
| 843 | 843 |
| 844 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI
d) | 844 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI
d) |
| 845 { | 845 { |
| 846 return contextGroupId ? m_sessions.get(contextGroupId) : nullptr; | 846 return contextGroupId ? m_sessions.get(contextGroupId) : nullptr; |
| 847 } | 847 } |
| 848 | 848 |
| 849 } // namespace blink | 849 } // namespace blink |
| OLD | NEW |