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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 int64_t port = DartUtils::GetInt64ValueCheckRange(port_arg, 0, 65535); | 113 int64_t port = DartUtils::GetInt64ValueCheckRange(port_arg, 0, 65535); |
114 VmService::SetServerIPAndPort(ip_chars, port); | 114 VmService::SetServerIPAndPort(ip_chars, port); |
115 Dart_ExitScope(); | 115 Dart_ExitScope(); |
116 } | 116 } |
117 | 117 |
118 | 118 |
119 static void Shutdown(Dart_NativeArguments args) { | 119 static void Shutdown(Dart_NativeArguments args) { |
120 // NO-OP. | 120 // NO-OP. |
121 } | 121 } |
122 | 122 |
| 123 |
123 struct VmServiceIONativeEntry { | 124 struct VmServiceIONativeEntry { |
124 const char* name; | 125 const char* name; |
125 int num_arguments; | 126 int num_arguments; |
126 Dart_NativeFunction function; | 127 Dart_NativeFunction function; |
127 }; | 128 }; |
128 | 129 |
129 | 130 |
130 static VmServiceIONativeEntry _VmServiceIONativeEntries[] = { | 131 static VmServiceIONativeEntry _VmServiceIONativeEntries[] = { |
131 {"VMServiceIO_NotifyServerState", 2, NotifyServerState}, | 132 {"VMServiceIO_NotifyServerState", 2, NotifyServerState}, |
132 {"VMServiceIO_Shutdown", 0, Shutdown }, | 133 {"VMServiceIO_Shutdown", 0, Shutdown }, |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 Dart_Handle field_name = Dart_NewStringFromCString("_signalWatch"); | 265 Dart_Handle field_name = Dart_NewStringFromCString("_signalWatch"); |
265 SHUTDOWN_ON_ERROR(field_name); | 266 SHUTDOWN_ON_ERROR(field_name); |
266 result = | 267 result = |
267 Dart_SetField(library, field_name, signal_watch); | 268 Dart_SetField(library, field_name, signal_watch); |
268 SHUTDOWN_ON_ERROR(field_name); | 269 SHUTDOWN_ON_ERROR(field_name); |
269 return true; | 270 return true; |
270 } | 271 } |
271 | 272 |
272 | 273 |
273 const char* VmService::GetErrorMessage() { | 274 const char* VmService::GetErrorMessage() { |
274 return error_msg_ == NULL ? "No error." : error_msg_; | 275 return (error_msg_ == NULL) ? "No error." : error_msg_; |
275 } | 276 } |
276 | 277 |
277 | 278 |
278 void VmService::SetServerIPAndPort(const char* ip, intptr_t port) { | 279 void VmService::SetServerIPAndPort(const char* ip, intptr_t port) { |
279 if (ip == NULL) { | 280 if (ip == NULL) { |
280 ip = ""; | 281 ip = ""; |
281 } | 282 } |
282 strncpy(server_ip_, ip, kServerIpStringBufferSize); | 283 strncpy(server_ip_, ip, kServerIpStringBufferSize); |
283 server_ip_[kServerIpStringBufferSize - 1] = '\0'; | 284 server_ip_[kServerIpStringBufferSize - 1] = '\0'; |
284 server_port_ = port; | 285 server_port_ = port; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 Dart_Handle source = GetSource(url_string); | 353 Dart_Handle source = GetSource(url_string); |
353 if (Dart_IsError(source)) { | 354 if (Dart_IsError(source)) { |
354 return source; | 355 return source; |
355 } | 356 } |
356 return Dart_LoadSource(library, url, source, 0, 0); | 357 return Dart_LoadSource(library, url, source, 0, 0); |
357 } | 358 } |
358 | 359 |
359 | 360 |
360 } // namespace bin | 361 } // namespace bin |
361 } // namespace dart | 362 } // namespace dart |
OLD | NEW |