OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "bin/vmservice_impl.h" | 5 #include "bin/vmservice_impl.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "bin/builtin.h" | 9 #include "bin/builtin.h" |
10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 Dart_Port VmService::port_ = ILLEGAL_PORT; | 53 Dart_Port VmService::port_ = ILLEGAL_PORT; |
54 dart::Monitor* VmService::monitor_ = NULL; | 54 dart::Monitor* VmService::monitor_ = NULL; |
55 const char* VmService::error_msg_ = NULL; | 55 const char* VmService::error_msg_ = NULL; |
56 | 56 |
57 // These must be kept in sync with vmservice/constants.dart | 57 // These must be kept in sync with vmservice/constants.dart |
58 #define VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID 1 | 58 #define VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID 1 |
59 #define VM_SERVICE_ISOLATE_SHUTDOWN_MESSAGE_ID 2 | 59 #define VM_SERVICE_ISOLATE_SHUTDOWN_MESSAGE_ID 2 |
60 | 60 |
61 | 61 |
62 static Dart_NativeFunction VmServiceNativeResolver(Dart_Handle name, | 62 static Dart_NativeFunction VmServiceNativeResolver(Dart_Handle name, |
63 int num_arguments); | 63 int num_arguments, |
| 64 bool* auto_setup_scope); |
64 | 65 |
65 | 66 |
66 bool VmService::Start(intptr_t server_port) { | 67 bool VmService::Start(intptr_t server_port) { |
67 monitor_ = new dart::Monitor(); | 68 monitor_ = new dart::Monitor(); |
68 ASSERT(monitor_ != NULL); | 69 ASSERT(monitor_ != NULL); |
69 error_msg_ = NULL; | 70 error_msg_ = NULL; |
70 | 71 |
71 | 72 |
72 { | 73 { |
73 // Take lock before spawning new thread. | 74 // Take lock before spawning new thread. |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 Dart_NativeFunction function; | 521 Dart_NativeFunction function; |
521 }; | 522 }; |
522 | 523 |
523 | 524 |
524 static VmServiceNativeEntry _VmServiceNativeEntries[] = { | 525 static VmServiceNativeEntry _VmServiceNativeEntries[] = { |
525 {"VMService_SendServiceMessage", 2, SendServiceMessage} | 526 {"VMService_SendServiceMessage", 2, SendServiceMessage} |
526 }; | 527 }; |
527 | 528 |
528 | 529 |
529 static Dart_NativeFunction VmServiceNativeResolver(Dart_Handle name, | 530 static Dart_NativeFunction VmServiceNativeResolver(Dart_Handle name, |
530 int num_arguments) { | 531 int num_arguments, |
| 532 bool* auto_setup_scope) { |
531 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); | 533 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); |
532 if (!obj.IsString()) { | 534 if (!obj.IsString()) { |
533 return NULL; | 535 return NULL; |
534 } | 536 } |
535 const char* function_name = obj.ToCString(); | 537 const char* function_name = obj.ToCString(); |
536 ASSERT(function_name != NULL); | 538 ASSERT(function_name != NULL); |
| 539 ASSERT(auto_setup_scope != NULL); |
| 540 *auto_setup_scope = true; |
537 intptr_t n = | 541 intptr_t n = |
538 sizeof(_VmServiceNativeEntries) / sizeof(_VmServiceNativeEntries[0]); | 542 sizeof(_VmServiceNativeEntries) / sizeof(_VmServiceNativeEntries[0]); |
539 for (intptr_t i = 0; i < n; i++) { | 543 for (intptr_t i = 0; i < n; i++) { |
540 VmServiceNativeEntry entry = _VmServiceNativeEntries[i]; | 544 VmServiceNativeEntry entry = _VmServiceNativeEntries[i]; |
541 if (!strcmp(function_name, entry.name) && | 545 if (!strcmp(function_name, entry.name) && |
542 (num_arguments == entry.num_arguments)) { | 546 (num_arguments == entry.num_arguments)) { |
543 return entry.function; | 547 return entry.function; |
544 } | 548 } |
545 } | 549 } |
546 return NULL; | 550 return NULL; |
547 } | 551 } |
548 | 552 |
549 } // namespace bin | 553 } // namespace bin |
550 } // namespace dart | 554 } // namespace dart |
OLD | NEW |