OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 "test/inspector/task-runner.h" | 5 #include "test/inspector/task-runner.h" |
6 | 6 |
7 #include "test/inspector/inspector-impl.h" | 7 #include "test/inspector/inspector-impl.h" |
8 | 8 |
9 #if !defined(_WIN32) && !defined(_WIN64) | 9 #if !defined(_WIN32) && !defined(_WIN64) |
10 #include <unistd.h> // NOLINT | 10 #include <unistd.h> // NOLINT |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 .ToLocalChecked(); | 234 .ToLocalChecked(); |
235 } | 235 } |
236 | 236 |
237 v8::ScriptCompiler::Source scriptSource(source, origin); | 237 v8::ScriptCompiler::Source scriptSource(source, origin); |
238 if (!is_module_) { | 238 if (!is_module_) { |
239 v8::Local<v8::Script> script; | 239 v8::Local<v8::Script> script; |
240 if (!v8::ScriptCompiler::Compile(local_context, &scriptSource) | 240 if (!v8::ScriptCompiler::Compile(local_context, &scriptSource) |
241 .ToLocal(&script)) | 241 .ToLocal(&script)) |
242 return; | 242 return; |
243 v8::MaybeLocal<v8::Value> result; | 243 v8::MaybeLocal<v8::Value> result; |
244 if (inspector_) | |
245 inspector_->willExecuteScript(local_context, | |
246 script->GetUnboundScript()->GetId()); | |
247 result = script->Run(local_context); | 244 result = script->Run(local_context); |
248 if (inspector_) inspector_->didExecuteScript(local_context); | |
249 } else { | 245 } else { |
250 v8::Local<v8::Module> module; | 246 v8::Local<v8::Module> module; |
251 if (!v8::ScriptCompiler::CompileModule(isolate, &scriptSource) | 247 if (!v8::ScriptCompiler::CompileModule(isolate, &scriptSource) |
252 .ToLocal(&module)) { | 248 .ToLocal(&module)) { |
253 return; | 249 return; |
254 } | 250 } |
255 if (!module->Instantiate(local_context, &TaskRunner::ModuleResolveCallback)) | 251 if (!module->Instantiate(local_context, &TaskRunner::ModuleResolveCallback)) |
256 return; | 252 return; |
257 v8::Local<v8::Value> result; | 253 v8::Local<v8::Value> result; |
258 if (!module->Evaluate(local_context).ToLocal(&result)) return; | 254 if (!module->Evaluate(local_context).ToLocal(&result)) return; |
259 TaskRunner* runner = TaskRunner::FromContext(local_context); | 255 TaskRunner* runner = TaskRunner::FromContext(local_context); |
260 runner->RegisterModule(name_, module); | 256 runner->RegisterModule(name_, module); |
261 } | 257 } |
262 } | 258 } |
OLD | NEW |