|
| 1 | +// Copyright 2015 the V8 project authors. All rights reserved. |
| 2 | +// Use of this source code is governed by a BSD-style license that can be |
| 3 | +// found in the LICENSE file. |
| 4 | + |
| 5 | +#include "NSV8DebuggerAgentImpl.h" |
| 6 | + |
| 7 | +namespace v8_inspector { |
| 8 | + |
| 9 | +NSV8DebuggerAgentImpl::NSV8DebuggerAgentImpl( |
| 10 | + V8InspectorSessionImpl* session, protocol::FrontendChannel* frontendChannel, |
| 11 | + protocol::DictionaryValue* state) |
| 12 | + : V8DebuggerAgentImpl(session, frontendChannel, state), |
| 13 | + m_env(tns::JEnv()){ |
| 14 | + |
| 15 | + auto runtimeClass = m_env.FindClass("com/tns/Runtime"); |
| 16 | + assert(runtimeClass != nullptr); |
| 17 | + |
| 18 | + auto getLineBreakpointsEnabledMethodID = m_env.GetStaticMethodID(runtimeClass, "getLineBreakpointsEnabled", "()Z"); |
| 19 | + assert(getLineBreakpointsEnabledMethodID != nullptr); |
| 20 | + |
| 21 | + auto lineBreakpointsEnabled = m_env.CallStaticBooleanMethod(runtimeClass, getLineBreakpointsEnabledMethodID); |
| 22 | + m_lineBreakpointsEnabled = lineBreakpointsEnabled == JNI_TRUE; |
| 23 | +} |
| 24 | + |
| 25 | +Response NSV8DebuggerAgentImpl::getPossibleBreakpoints( |
| 26 | + std::unique_ptr<protocol::Debugger::Location> start, |
| 27 | + Maybe<protocol::Debugger::Location> end, Maybe<bool> restrictToFunction, |
| 28 | + std::unique_ptr<protocol::Array<protocol::Debugger::BreakLocation>>* |
| 29 | + locations) { |
| 30 | + if(m_lineBreakpointsEnabled) { |
| 31 | + return V8DebuggerAgentImpl::getPossibleBreakpoints(std::move(start), std::move(end), std::move(restrictToFunction), locations); |
| 32 | + } else { |
| 33 | + *locations = protocol::Array<protocol::Debugger::BreakLocation>::create(); |
| 34 | + return Response::OK(); |
| 35 | + } |
| 36 | +} |
| 37 | + |
| 38 | +} // namespace v8_inspector |
0 commit comments