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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 "native function quit();" | 54 "native function quit();" |
55 "native function setlocale();" | 55 "native function setlocale();" |
56 "native function read();" | 56 "native function read();" |
57 "native function load();" | 57 "native function load();" |
58 "native function compileAndRunWithOrigin();" | 58 "native function compileAndRunWithOrigin();" |
59 "native function setCurrentTimeMSForTest();" | 59 "native function setCurrentTimeMSForTest();" |
60 "native function setMemoryInfoForTest();" | 60 "native function setMemoryInfoForTest();" |
61 "native function schedulePauseOnNextStatement();" | 61 "native function schedulePauseOnNextStatement();" |
62 "native function cancelPauseOnNextStatement();" | 62 "native function cancelPauseOnNextStatement();" |
63 "native function reconnect();" | 63 "native function reconnect();" |
| 64 "native function setLogConsoleApiMessageCalls();" |
64 "native function createContextGroup();") {} | 65 "native function createContextGroup();") {} |
65 virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( | 66 virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( |
66 v8::Isolate* isolate, v8::Local<v8::String> name) { | 67 v8::Isolate* isolate, v8::Local<v8::String> name) { |
67 v8::Local<v8::Context> context = isolate->GetCurrentContext(); | 68 v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
68 if (name->Equals(context, v8::String::NewFromUtf8( | 69 if (name->Equals(context, v8::String::NewFromUtf8( |
69 isolate, "print", v8::NewStringType::kNormal) | 70 isolate, "print", v8::NewStringType::kNormal) |
70 .ToLocalChecked()) | 71 .ToLocalChecked()) |
71 .FromJust()) { | 72 .FromJust()) { |
72 return v8::FunctionTemplate::New(isolate, UtilsExtension::Print); | 73 return v8::FunctionTemplate::New(isolate, UtilsExtension::Print); |
73 } else if (name->Equals(context, | 74 } else if (name->Equals(context, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 .ToLocalChecked()) | 130 .ToLocalChecked()) |
130 .FromJust()) { | 131 .FromJust()) { |
131 return v8::FunctionTemplate::New( | 132 return v8::FunctionTemplate::New( |
132 isolate, UtilsExtension::CancelPauseOnNextStatement); | 133 isolate, UtilsExtension::CancelPauseOnNextStatement); |
133 } else if (name->Equals(context, | 134 } else if (name->Equals(context, |
134 v8::String::NewFromUtf8(isolate, "reconnect", | 135 v8::String::NewFromUtf8(isolate, "reconnect", |
135 v8::NewStringType::kNormal) | 136 v8::NewStringType::kNormal) |
136 .ToLocalChecked()) | 137 .ToLocalChecked()) |
137 .FromJust()) { | 138 .FromJust()) { |
138 return v8::FunctionTemplate::New(isolate, UtilsExtension::Reconnect); | 139 return v8::FunctionTemplate::New(isolate, UtilsExtension::Reconnect); |
| 140 } else if (name->Equals(context, |
| 141 v8::String::NewFromUtf8( |
| 142 isolate, "setLogConsoleApiMessageCalls", |
| 143 v8::NewStringType::kNormal) |
| 144 .ToLocalChecked()) |
| 145 .FromJust()) { |
| 146 return v8::FunctionTemplate::New( |
| 147 isolate, UtilsExtension::SetLogConsoleApiMessageCalls); |
139 } else if (name->Equals(context, v8::String::NewFromUtf8( | 148 } else if (name->Equals(context, v8::String::NewFromUtf8( |
140 isolate, "createContextGroup", | 149 isolate, "createContextGroup", |
141 v8::NewStringType::kNormal) | 150 v8::NewStringType::kNormal) |
142 .ToLocalChecked()) | 151 .ToLocalChecked()) |
143 .FromJust()) { | 152 .FromJust()) { |
144 return v8::FunctionTemplate::New(isolate, | 153 return v8::FunctionTemplate::New(isolate, |
145 UtilsExtension::CreateContextGroup); | 154 UtilsExtension::CreateContextGroup); |
146 } | 155 } |
147 return v8::Local<v8::FunctionTemplate>(); | 156 return v8::Local<v8::FunctionTemplate>(); |
148 } | 157 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 static void Reconnect(const v8::FunctionCallbackInfo<v8::Value>& args) { | 320 static void Reconnect(const v8::FunctionCallbackInfo<v8::Value>& args) { |
312 if (args.Length() != 0) { | 321 if (args.Length() != 0) { |
313 fprintf(stderr, "Internal error: reconnect()."); | 322 fprintf(stderr, "Internal error: reconnect()."); |
314 Exit(); | 323 Exit(); |
315 } | 324 } |
316 v8::base::Semaphore ready_semaphore(0); | 325 v8::base::Semaphore ready_semaphore(0); |
317 inspector_client_->scheduleReconnect(&ready_semaphore); | 326 inspector_client_->scheduleReconnect(&ready_semaphore); |
318 ready_semaphore.Wait(); | 327 ready_semaphore.Wait(); |
319 } | 328 } |
320 | 329 |
| 330 static void SetLogConsoleApiMessageCalls( |
| 331 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 332 if (args.Length() != 1 || !args[0]->IsBoolean()) { |
| 333 fprintf(stderr, "Internal error: setLogConsoleApiMessageCalls(bool)."); |
| 334 Exit(); |
| 335 } |
| 336 inspector_client_->setLogConsoleApiMessageCalls( |
| 337 args[0].As<v8::Boolean>()->Value()); |
| 338 } |
| 339 |
321 static void CreateContextGroup( | 340 static void CreateContextGroup( |
322 const v8::FunctionCallbackInfo<v8::Value>& args) { | 341 const v8::FunctionCallbackInfo<v8::Value>& args) { |
323 if (args.Length() != 0) { | 342 if (args.Length() != 0) { |
324 fprintf(stderr, "Internal error: createContextGroup()."); | 343 fprintf(stderr, "Internal error: createContextGroup()."); |
325 Exit(); | 344 Exit(); |
326 } | 345 } |
327 const char* backend_extensions[] = {"v8_inspector/setTimeout", | 346 const char* backend_extensions[] = {"v8_inspector/setTimeout", |
328 "v8_inspector/inspector"}; | 347 "v8_inspector/inspector"}; |
329 v8::ExtensionConfiguration backend_configuration( | 348 v8::ExtensionConfiguration backend_configuration( |
330 arraysize(backend_extensions), backend_extensions); | 349 arraysize(backend_extensions), backend_extensions); |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 argv[i]); | 716 argv[i]); |
698 Exit(); | 717 Exit(); |
699 } | 718 } |
700 frontend_runner.Append(new ExecuteStringTask(chars)); | 719 frontend_runner.Append(new ExecuteStringTask(chars)); |
701 } | 720 } |
702 | 721 |
703 frontend_runner.Join(); | 722 frontend_runner.Join(); |
704 backend_runner.Join(); | 723 backend_runner.Join(); |
705 return 0; | 724 return 0; |
706 } | 725 } |
OLD | NEW |