| 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 528 |
| 529 | 529 |
| 530 struct VmServiceNativeEntry { | 530 struct VmServiceNativeEntry { |
| 531 const char* name; | 531 const char* name; |
| 532 int num_arguments; | 532 int num_arguments; |
| 533 Dart_NativeFunction function; | 533 Dart_NativeFunction function; |
| 534 }; | 534 }; |
| 535 | 535 |
| 536 | 536 |
| 537 static VmServiceNativeEntry _VmServiceNativeEntries[] = { | 537 static VmServiceNativeEntry _VmServiceNativeEntries[] = { |
| 538 {"SendServiceMessage", 3, SendServiceMessage} | 538 {"VMService_SendServiceMessage", 3, SendServiceMessage} |
| 539 }; | 539 }; |
| 540 | 540 |
| 541 | 541 |
| 542 static Dart_NativeFunction VmServiceNativeResolver(Dart_Handle name, | 542 static Dart_NativeFunction VmServiceNativeResolver(Dart_Handle name, |
| 543 int num_arguments) { | 543 int num_arguments) { |
| 544 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); | 544 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); |
| 545 if (!obj.IsString()) { | 545 if (!obj.IsString()) { |
| 546 return NULL; | 546 return NULL; |
| 547 } | 547 } |
| 548 const char* function_name = obj.ToCString(); | 548 const char* function_name = obj.ToCString(); |
| 549 ASSERT(function_name != NULL); | 549 ASSERT(function_name != NULL); |
| 550 intptr_t n = | 550 intptr_t n = |
| 551 sizeof(_VmServiceNativeEntries) / sizeof(_VmServiceNativeEntries[0]); | 551 sizeof(_VmServiceNativeEntries) / sizeof(_VmServiceNativeEntries[0]); |
| 552 for (intptr_t i = 0; i < n; i++) { | 552 for (intptr_t i = 0; i < n; i++) { |
| 553 VmServiceNativeEntry entry = _VmServiceNativeEntries[i]; | 553 VmServiceNativeEntry entry = _VmServiceNativeEntries[i]; |
| 554 if (!strcmp(function_name, entry.name) && | 554 if (!strcmp(function_name, entry.name) && |
| 555 (num_arguments == entry.num_arguments)) { | 555 (num_arguments == entry.num_arguments)) { |
| 556 return entry.function; | 556 return entry.function; |
| 557 } | 557 } |
| 558 } | 558 } |
| 559 return NULL; | 559 return NULL; |
| 560 } | 560 } |
| 561 | 561 |
| 562 } // namespace bin | 562 } // namespace bin |
| 563 } // namespace dart | 563 } // namespace dart |
| OLD | NEW |