| 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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 agent->willExecuteScript(function->ScriptId()); | 802 agent->willExecuteScript(function->ScriptId()); |
| 803 v8::MaybeLocal<v8::Value> result = function->Call(context, receiver, argc, i
nfo); | 803 v8::MaybeLocal<v8::Value> result = function->Call(context, receiver, argc, i
nfo); |
| 804 // Get agent from the map again, since it could have detached during script
execution. | 804 // Get agent from the map again, since it could have detached during script
execution. |
| 805 if (V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(groupId)) | 805 if (V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(groupId)) |
| 806 agent->didExecuteScript(); | 806 agent->didExecuteScript(); |
| 807 return result; | 807 return result; |
| 808 } | 808 } |
| 809 | 809 |
| 810 v8::MaybeLocal<v8::Value> V8DebuggerImpl::compileAndRunInternalScript(v8::Local<
v8::Context> context, v8::Local<v8::String> source) | 810 v8::MaybeLocal<v8::Value> V8DebuggerImpl::compileAndRunInternalScript(v8::Local<
v8::Context> context, v8::Local<v8::String> source) |
| 811 { | 811 { |
| 812 v8::Local<v8::Script> script = compileInternalScript(context, source, String
()); | 812 v8::Local<v8::Script> script = compileScript(context, source, String(), true
); |
| 813 if (script.IsEmpty()) | 813 if (script.IsEmpty()) |
| 814 return v8::MaybeLocal<v8::Value>(); | 814 return v8::MaybeLocal<v8::Value>(); |
| 815 v8::MicrotasksScope microtasksScope(m_isolate, v8::MicrotasksScope::kDoNotRu
nMicrotasks); | 815 v8::MicrotasksScope microtasksScope(m_isolate, v8::MicrotasksScope::kDoNotRu
nMicrotasks); |
| 816 return script->Run(context); | 816 return script->Run(context); |
| 817 } | 817 } |
| 818 | 818 |
| 819 v8::Local<v8::Script> V8DebuggerImpl::compileInternalScript(v8::Local<v8::Contex
t> context, v8::Local<v8::String> code, const String16& fileName) | 819 v8::Local<v8::Script> V8DebuggerImpl::compileScript(v8::Local<v8::Context> conte
xt, v8::Local<v8::String> code, const String16& fileName, bool markAsInternal) |
| 820 { | 820 { |
| 821 // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at | |
| 822 // 1, whereas v8 starts at 0. | |
| 823 v8::ScriptOrigin origin( | 821 v8::ScriptOrigin origin( |
| 824 toV8String(m_isolate, fileName), | 822 toV8String(m_isolate, fileName), |
| 825 v8::Integer::New(m_isolate, 0), | 823 v8::Integer::New(m_isolate, 0), |
| 826 v8::Integer::New(m_isolate, 0), | 824 v8::Integer::New(m_isolate, 0), |
| 827 v8::False(m_isolate), // sharable | 825 v8::False(m_isolate), // sharable |
| 828 v8::Local<v8::Integer>(), | 826 v8::Local<v8::Integer>(), |
| 829 v8::True(m_isolate), // internal | 827 v8::Boolean::New(m_isolate, markAsInternal), // internal |
| 830 toV8String(m_isolate, String16()), // sourceMap | 828 toV8String(m_isolate, String16()), // sourceMap |
| 831 v8::True(m_isolate)); // opaqueresource | 829 v8::True(m_isolate)); // opaqueresource |
| 832 v8::ScriptCompiler::Source source(code, origin); | 830 v8::ScriptCompiler::Source source(code, origin); |
| 833 v8::Local<v8::Script> script; | 831 v8::Local<v8::Script> script; |
| 834 if (!v8::ScriptCompiler::Compile(context, &source, v8::ScriptCompiler::kNoCo
mpileOptions).ToLocal(&script)) | 832 if (!v8::ScriptCompiler::Compile(context, &source, v8::ScriptCompiler::kNoCo
mpileOptions).ToLocal(&script)) |
| 835 return v8::Local<v8::Script>(); | 833 return v8::Local<v8::Script>(); |
| 836 return script; | 834 return script; |
| 837 } | 835 } |
| 838 | 836 |
| 839 void V8DebuggerImpl::enableStackCapturingIfNeeded() | 837 void V8DebuggerImpl::enableStackCapturingIfNeeded() |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 | 1140 |
| 1143 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI
d) | 1141 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI
d) |
| 1144 { | 1142 { |
| 1145 if (!contextGroupId) | 1143 if (!contextGroupId) |
| 1146 return nullptr; | 1144 return nullptr; |
| 1147 SessionMap::iterator iter = m_sessions.find(contextGroupId); | 1145 SessionMap::iterator iter = m_sessions.find(contextGroupId); |
| 1148 return iter == m_sessions.end() ? nullptr : iter->second; | 1146 return iter == m_sessions.end() ? nullptr : iter->second; |
| 1149 } | 1147 } |
| 1150 | 1148 |
| 1151 } // namespace blink | 1149 } // namespace blink |
| OLD | NEW |