OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 12 matching lines...) Expand all Loading... |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "src/inspector/java-script-call-frame.h" | 31 #include "src/inspector/java-script-call-frame.h" |
32 | 32 |
| 33 #include "src/debug/debug-interface.h" |
33 #include "src/inspector/string-util.h" | 34 #include "src/inspector/string-util.h" |
34 | 35 |
35 #include "include/v8-debug.h" | |
36 | |
37 namespace v8_inspector { | 36 namespace v8_inspector { |
38 | 37 |
39 JavaScriptCallFrame::JavaScriptCallFrame(v8::Local<v8::Context> debuggerContext, | 38 JavaScriptCallFrame::JavaScriptCallFrame(v8::Local<v8::Context> debuggerContext, |
40 v8::Local<v8::Object> callFrame) | 39 v8::Local<v8::Object> callFrame) |
41 : m_isolate(debuggerContext->GetIsolate()), | 40 : m_isolate(debuggerContext->GetIsolate()), |
42 m_debuggerContext(m_isolate, debuggerContext), | 41 m_debuggerContext(m_isolate, debuggerContext), |
43 m_callFrame(m_isolate, callFrame) {} | 42 m_callFrame(m_isolate, callFrame) {} |
44 | 43 |
45 JavaScriptCallFrame::~JavaScriptCallFrame() {} | 44 JavaScriptCallFrame::~JavaScriptCallFrame() {} |
46 | 45 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() { | 122 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() { |
124 v8::MicrotasksScope microtasks(m_isolate, | 123 v8::MicrotasksScope microtasks(m_isolate, |
125 v8::MicrotasksScope::kDoNotRunMicrotasks); | 124 v8::MicrotasksScope::kDoNotRunMicrotasks); |
126 v8::Local<v8::Context> context = | 125 v8::Local<v8::Context> context = |
127 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); | 126 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); |
128 v8::Local<v8::Object> callFrame = | 127 v8::Local<v8::Object> callFrame = |
129 v8::Local<v8::Object>::New(m_isolate, m_callFrame); | 128 v8::Local<v8::Object>::New(m_isolate, m_callFrame); |
130 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast( | 129 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast( |
131 callFrame->Get(context, toV8StringInternalized(m_isolate, "restart")) | 130 callFrame->Get(context, toV8StringInternalized(m_isolate, "restart")) |
132 .ToLocalChecked()); | 131 .ToLocalChecked()); |
133 v8::Debug::SetLiveEditEnabled(m_isolate, true); | 132 v8::DebugInterface::SetLiveEditEnabled(m_isolate, true); |
134 v8::MaybeLocal<v8::Value> result = restartFunction->Call( | 133 v8::MaybeLocal<v8::Value> result = restartFunction->Call( |
135 m_debuggerContext.Get(m_isolate), callFrame, 0, nullptr); | 134 m_debuggerContext.Get(m_isolate), callFrame, 0, nullptr); |
136 v8::Debug::SetLiveEditEnabled(m_isolate, false); | 135 v8::DebugInterface::SetLiveEditEnabled(m_isolate, false); |
137 return result; | 136 return result; |
138 } | 137 } |
139 | 138 |
140 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::setVariableValue( | 139 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::setVariableValue( |
141 int scopeNumber, v8::Local<v8::Value> variableName, | 140 int scopeNumber, v8::Local<v8::Value> variableName, |
142 v8::Local<v8::Value> newValue) { | 141 v8::Local<v8::Value> newValue) { |
143 v8::MicrotasksScope microtasks(m_isolate, | 142 v8::MicrotasksScope microtasks(m_isolate, |
144 v8::MicrotasksScope::kDoNotRunMicrotasks); | 143 v8::MicrotasksScope::kDoNotRunMicrotasks); |
145 v8::Local<v8::Context> context = | 144 v8::Local<v8::Context> context = |
146 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); | 145 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); |
147 v8::Local<v8::Object> callFrame = | 146 v8::Local<v8::Object> callFrame = |
148 v8::Local<v8::Object>::New(m_isolate, m_callFrame); | 147 v8::Local<v8::Object>::New(m_isolate, m_callFrame); |
149 v8::Local<v8::Function> setVariableValueFunction = | 148 v8::Local<v8::Function> setVariableValueFunction = |
150 v8::Local<v8::Function>::Cast( | 149 v8::Local<v8::Function>::Cast( |
151 callFrame | 150 callFrame |
152 ->Get(context, | 151 ->Get(context, |
153 toV8StringInternalized(m_isolate, "setVariableValue")) | 152 toV8StringInternalized(m_isolate, "setVariableValue")) |
154 .ToLocalChecked()); | 153 .ToLocalChecked()); |
155 v8::Local<v8::Value> argv[] = { | 154 v8::Local<v8::Value> argv[] = { |
156 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), | 155 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), |
157 variableName, newValue}; | 156 variableName, newValue}; |
158 return setVariableValueFunction->Call(context, callFrame, arraysize(argv), | 157 return setVariableValueFunction->Call(context, callFrame, arraysize(argv), |
159 argv); | 158 argv); |
160 } | 159 } |
161 | 160 |
162 } // namespace v8_inspector | 161 } // namespace v8_inspector |
OLD | NEW |