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 #if !defined(_WIN32) && !defined(_WIN64) | 5 #if !defined(_WIN32) && !defined(_WIN64) |
6 #include <unistd.h> // NOLINT | 6 #include <unistd.h> // NOLINT |
7 #endif // !defined(_WIN32) && !defined(_WIN64) | 7 #endif // !defined(_WIN32) && !defined(_WIN64) |
8 | 8 |
9 #include <locale.h> | 9 #include <locale.h> |
10 | 10 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 .ToLocalChecked()); | 191 .ToLocalChecked()); |
192 return; | 192 return; |
193 } | 193 } |
194 ExecuteStringTask task(chars); | 194 ExecuteStringTask task(chars); |
195 v8::Global<v8::Context> context(isolate, isolate->GetCurrentContext()); | 195 v8::Global<v8::Context> context(isolate, isolate->GetCurrentContext()); |
196 task.Run(isolate, context); | 196 task.Run(isolate, context); |
197 } | 197 } |
198 | 198 |
199 static void CompileAndRunWithOrigin( | 199 static void CompileAndRunWithOrigin( |
200 const v8::FunctionCallbackInfo<v8::Value>& args) { | 200 const v8::FunctionCallbackInfo<v8::Value>& args) { |
201 if (args.Length() != 4 || !args[0]->IsString() || !args[1]->IsString() || | 201 if (args.Length() != 5 || !args[0]->IsString() || !args[1]->IsString() || |
202 !args[2]->IsInt32() || !args[3]->IsInt32()) { | 202 !args[2]->IsInt32() || !args[3]->IsInt32() || !args[4]->IsBoolean()) { |
203 fprintf(stderr, | 203 fprintf(stderr, |
204 "Internal error: compileAndRunWithOrigin(source, name, line, " | 204 "Internal error: compileAndRunWithOrigin(source, name, line, " |
205 "column)."); | 205 "column, is_module)."); |
206 Exit(); | 206 Exit(); |
207 } | 207 } |
208 | 208 |
209 backend_runner_->Append(new ExecuteStringTask( | 209 backend_runner_->Append(new ExecuteStringTask( |
210 ToVector(args[0].As<v8::String>()), args[1].As<v8::String>(), | 210 ToVector(args[0].As<v8::String>()), args[1].As<v8::String>(), |
211 args[2].As<v8::Int32>(), args[3].As<v8::Int32>(), nullptr, nullptr)); | 211 args[2].As<v8::Int32>(), args[3].As<v8::Int32>(), |
| 212 args[4].As<v8::Boolean>(), nullptr, nullptr)); |
212 } | 213 } |
213 | 214 |
214 static void SetCurrentTimeMSForTest( | 215 static void SetCurrentTimeMSForTest( |
215 const v8::FunctionCallbackInfo<v8::Value>& args) { | 216 const v8::FunctionCallbackInfo<v8::Value>& args) { |
216 if (args.Length() != 1 || !args[0]->IsNumber()) { | 217 if (args.Length() != 1 || !args[0]->IsNumber()) { |
217 fprintf(stderr, "Internal error: setCurrentTimeMSForTest(time)."); | 218 fprintf(stderr, "Internal error: setCurrentTimeMSForTest(time)."); |
218 Exit(); | 219 Exit(); |
219 } | 220 } |
220 inspector_client_->setCurrentTimeMSForTest( | 221 inspector_client_->setCurrentTimeMSForTest( |
221 args[0].As<v8::Number>()->Value()); | 222 args[0].As<v8::Number>()->Value()); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 v8_inspector::V8Inspector* inspector = | 307 v8_inspector::V8Inspector* inspector = |
307 InspectorClientImpl::InspectorFromContext(context); | 308 InspectorClientImpl::InspectorFromContext(context); |
308 if (args[0]->IsFunction()) { | 309 if (args[0]->IsFunction()) { |
309 task.reset(new SetTimeoutTask(isolate, | 310 task.reset(new SetTimeoutTask(isolate, |
310 v8::Local<v8::Function>::Cast(args[0]), | 311 v8::Local<v8::Function>::Cast(args[0]), |
311 "setTimeout", inspector)); | 312 "setTimeout", inspector)); |
312 } else { | 313 } else { |
313 task.reset(new ExecuteStringTask( | 314 task.reset(new ExecuteStringTask( |
314 ToVector(args[0].As<v8::String>()), v8::String::Empty(isolate), | 315 ToVector(args[0].As<v8::String>()), v8::String::Empty(isolate), |
315 v8::Integer::New(isolate, 0), v8::Integer::New(isolate, 0), | 316 v8::Integer::New(isolate, 0), v8::Integer::New(isolate, 0), |
316 "setTimeout", inspector)); | 317 v8::Boolean::New(isolate, false), "setTimeout", inspector)); |
317 } | 318 } |
318 TaskRunner::FromContext(context)->Append(task.release()); | 319 TaskRunner::FromContext(context)->Append(task.release()); |
319 } | 320 } |
320 }; | 321 }; |
321 | 322 |
322 class InspectorExtension : public v8::Extension { | 323 class InspectorExtension : public v8::Extension { |
323 public: | 324 public: |
324 InspectorExtension() | 325 InspectorExtension() |
325 : v8::Extension("v8_inspector/inspector", | 326 : v8::Extension("v8_inspector/inspector", |
326 "native function attachInspector();" | 327 "native function attachInspector();" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 v8::NewStringType::kInternalized) | 449 v8::NewStringType::kInternalized) |
449 .ToLocalChecked(); | 450 .ToLocalChecked(); |
450 v8::Local<v8::String> message_string = ToString(isolate, message); | 451 v8::Local<v8::String> message_string = ToString(isolate, message); |
451 v8::Local<v8::String> suffix = | 452 v8::Local<v8::String> suffix = |
452 v8::String::NewFromUtf8(isolate, ")", v8::NewStringType::kInternalized) | 453 v8::String::NewFromUtf8(isolate, ")", v8::NewStringType::kInternalized) |
453 .ToLocalChecked(); | 454 .ToLocalChecked(); |
454 | 455 |
455 v8::Local<v8::String> result = v8::String::Concat(prefix, message_string); | 456 v8::Local<v8::String> result = v8::String::Concat(prefix, message_string); |
456 result = v8::String::Concat(result, suffix); | 457 result = v8::String::Concat(result, suffix); |
457 | 458 |
458 frontend_task_runner_->Append( | 459 frontend_task_runner_->Append(new ExecuteStringTask( |
459 new ExecuteStringTask(ToVector(result), v8::String::Empty(isolate), | 460 ToVector(result), v8::String::Empty(isolate), |
460 v8::Integer::New(isolate, 0), | 461 v8::Integer::New(isolate, 0), v8::Integer::New(isolate, 0), |
461 v8::Integer::New(isolate, 0), nullptr, nullptr)); | 462 v8::Boolean::New(isolate, false), nullptr, nullptr)); |
462 } | 463 } |
463 | 464 |
464 private: | 465 private: |
465 TaskRunner* frontend_task_runner_; | 466 TaskRunner* frontend_task_runner_; |
466 }; | 467 }; |
467 | 468 |
468 } // namespace | 469 } // namespace |
469 | 470 |
470 int main(int argc, char* argv[]) { | 471 int main(int argc, char* argv[]) { |
471 v8::V8::InitializeICUDefaultLocation(argv[0]); | 472 v8::V8::InitializeICUDefaultLocation(argv[0]); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 argv[i]); | 523 argv[i]); |
523 Exit(); | 524 Exit(); |
524 } | 525 } |
525 frontend_runner.Append(new ExecuteStringTask(chars)); | 526 frontend_runner.Append(new ExecuteStringTask(chars)); |
526 } | 527 } |
527 | 528 |
528 frontend_runner.Join(); | 529 frontend_runner.Join(); |
529 backend_runner.Join(); | 530 backend_runner.Join(); |
530 return 0; | 531 return 0; |
531 } | 532 } |
OLD | NEW |