| 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 29 matching lines...) Expand all Loading... |
| 40 Dart_ShutdownIsolate(); \ | 40 Dart_ShutdownIsolate(); \ |
| 41 return false; \ | 41 return false; \ |
| 42 } | 42 } |
| 43 | 43 |
| 44 #define kLibraryResourceNamePrefix "/vmservice" | 44 #define kLibraryResourceNamePrefix "/vmservice" |
| 45 static const char* kVMServiceIOLibraryScriptResourceName = | 45 static const char* kVMServiceIOLibraryScriptResourceName = |
| 46 kLibraryResourceNamePrefix "/vmservice_io.dart"; | 46 kLibraryResourceNamePrefix "/vmservice_io.dart"; |
| 47 static const char* kVMServiceLibraryName = | 47 static const char* kVMServiceLibraryName = |
| 48 kLibraryResourceNamePrefix "/vmservice.dart"; | 48 kLibraryResourceNamePrefix "/vmservice.dart"; |
| 49 | 49 |
| 50 #define kClientResourceNamePrefix "/vmservice/client" | 50 #define kClientResourceNamePrefix "/client/web/out" |
| 51 | 51 |
| 52 Dart_Isolate VmService::isolate_ = NULL; | 52 Dart_Isolate VmService::isolate_ = NULL; |
| 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 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 Dart_EnterIsolate(isolate_); | 139 Dart_EnterIsolate(isolate_); |
| 140 Dart_EnterScope(); | 140 Dart_EnterScope(); |
| 141 | 141 |
| 142 | 142 |
| 143 Dart_Handle library = Dart_RootLibrary(); | 143 Dart_Handle library = Dart_RootLibrary(); |
| 144 // Set requested port. | 144 // Set requested port. |
| 145 DartUtils::SetIntegerField(library, "_port", server_port); | 145 DartUtils::SetIntegerField(library, "_port", server_port); |
| 146 result = Dart_Invoke(library, DartUtils::NewString("main"), 0, NULL); | 146 result = Dart_Invoke(library, DartUtils::NewString("main"), 0, NULL); |
| 147 SHUTDOWN_ON_ERROR(result); | 147 SHUTDOWN_ON_ERROR(result); |
| 148 | 148 |
| 149 Dart_Handle library_name = Dart_NewStringFromCString(kVMServiceLibraryName); | |
| 150 library = Dart_LookupLibrary(library_name); | |
| 151 SHUTDOWN_ON_ERROR(library); | |
| 152 result = LoadResources(library); | 149 result = LoadResources(library); |
| 153 SHUTDOWN_ON_ERROR(result); | 150 SHUTDOWN_ON_ERROR(result); |
| 154 result = Dart_CompileAll(); | 151 result = Dart_CompileAll(); |
| 155 SHUTDOWN_ON_ERROR(result); | 152 SHUTDOWN_ON_ERROR(result); |
| 156 | 153 |
| 157 port_ = Dart_GetMainPortId(); | 154 port_ = Dart_GetMainPortId(); |
| 158 | 155 |
| 159 Dart_ExitScope(); | 156 Dart_ExitScope(); |
| 160 Dart_ExitIsolate(); | 157 Dart_ExitIsolate(); |
| 161 | 158 |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 if (!strcmp(function_name, entry.name) && | 516 if (!strcmp(function_name, entry.name) && |
| 520 (num_arguments == entry.num_arguments)) { | 517 (num_arguments == entry.num_arguments)) { |
| 521 return entry.function; | 518 return entry.function; |
| 522 } | 519 } |
| 523 } | 520 } |
| 524 return NULL; | 521 return NULL; |
| 525 } | 522 } |
| 526 | 523 |
| 527 } // namespace bin | 524 } // namespace bin |
| 528 } // namespace dart | 525 } // namespace dart |
| OLD | NEW |