| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 server_port_ = port; | 259 server_port_ = port; |
| 260 } | 260 } |
| 261 | 261 |
| 262 | 262 |
| 263 Dart_Handle VmService::GetSource(const char* name) { | 263 Dart_Handle VmService::GetSource(const char* name) { |
| 264 const intptr_t kBufferSize = 512; | 264 const intptr_t kBufferSize = 512; |
| 265 char buffer[kBufferSize]; | 265 char buffer[kBufferSize]; |
| 266 snprintf(&buffer[0], kBufferSize-1, "%s/%s", kLibrarySourceNamePrefix, name); | 266 snprintf(&buffer[0], kBufferSize-1, "%s/%s", kLibrarySourceNamePrefix, name); |
| 267 const char* vmservice_source = NULL; | 267 const char* vmservice_source = NULL; |
| 268 int r = Resources::ResourceLookup(buffer, &vmservice_source); | 268 int r = Resources::ResourceLookup(buffer, &vmservice_source); |
| 269 if (r == Resources::kNoSuchInstance) { |
| 270 FATAL1("vm-service: Could not find embedded source file: %s ", buffer); |
| 271 } |
| 269 ASSERT(r != Resources::kNoSuchInstance); | 272 ASSERT(r != Resources::kNoSuchInstance); |
| 270 return Dart_NewStringFromCString(vmservice_source); | 273 return Dart_NewStringFromCString(vmservice_source); |
| 271 } | 274 } |
| 272 | 275 |
| 273 | 276 |
| 274 Dart_Handle VmService::LoadScript(const char* name) { | 277 Dart_Handle VmService::LoadScript(const char* name) { |
| 275 Dart_Handle url = Dart_NewStringFromCString("dart:vmservice_io"); | 278 Dart_Handle url = Dart_NewStringFromCString("dart:vmservice_io"); |
| 276 Dart_Handle source = GetSource(name); | 279 Dart_Handle source = GetSource(name); |
| 277 return Dart_LoadScript(url, source, 0, 0); | 280 return Dart_LoadScript(url, source, 0, 0); |
| 278 } | 281 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 Dart_Handle source = GetSource(url_string); | 376 Dart_Handle source = GetSource(url_string); |
| 374 if (Dart_IsError(source)) { | 377 if (Dart_IsError(source)) { |
| 375 return source; | 378 return source; |
| 376 } | 379 } |
| 377 return Dart_LoadSource(library, url, source, 0, 0); | 380 return Dart_LoadSource(library, url, source, 0, 0); |
| 378 } | 381 } |
| 379 | 382 |
| 380 | 383 |
| 381 } // namespace bin | 384 } // namespace bin |
| 382 } // namespace dart | 385 } // namespace dart |
| OLD | NEW |