| 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 // Generate a snapshot file after loading all the scripts specified on the | 5 // Generate a snapshot file after loading all the scripts specified on the |
| 6 // command line. | 6 // command line. |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 | 347 |
| 348 // Get the file path out of the url. | 348 // Get the file path out of the url. |
| 349 Dart_Handle file_path = FilePathFromUri( | 349 Dart_Handle file_path = FilePathFromUri( |
| 350 DartUtils::GetStringValue(resolved_url)); | 350 DartUtils::GetStringValue(resolved_url)); |
| 351 if (Dart_IsError(file_path)) { | 351 if (Dart_IsError(file_path)) { |
| 352 return file_path; | 352 return file_path; |
| 353 } | 353 } |
| 354 | 354 |
| 355 return DartUtils::LoadSource(library, | 355 Dart_Handle builtin_lib = |
| 356 url, | 356 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); |
| 357 tag, | 357 Dart_Handle result = DartUtils::LoadSourceAsync(library, |
| 358 DartUtils::GetStringValue(file_path)); | 358 url, |
| 359 tag, |
| 360 builtin_lib); |
| 361 if (Dart_IsError(result)) { |
| 362 return result; |
| 363 } |
| 364 return Dart_RunLoop(); |
| 359 } | 365 } |
| 360 | 366 |
| 361 | 367 |
| 362 static Dart_Handle LoadSnapshotCreationScript(const char* script_name) { | 368 static Dart_Handle LoadSnapshotCreationScript(const char* script_name) { |
| 363 Dart_Handle resolved_script_uri = ResolveScriptUri(script_name); | 369 Dart_Handle resolved_script_uri = ResolveScriptUri(script_name); |
| 364 if (Dart_IsError(resolved_script_uri)) { | 370 if (Dart_IsError(resolved_script_uri)) { |
| 365 return resolved_script_uri; | 371 return resolved_script_uri; |
| 366 } | 372 } |
| 367 Dart_Handle script_path = FilePathFromUri( | 373 Dart_Handle script_path = FilePathFromUri( |
| 368 DartUtils::GetStringValue(resolved_script_uri)); | 374 DartUtils::GetStringValue(resolved_script_uri)); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 589 } |
| 584 return 0; | 590 return 0; |
| 585 } | 591 } |
| 586 | 592 |
| 587 } // namespace bin | 593 } // namespace bin |
| 588 } // namespace dart | 594 } // namespace dart |
| 589 | 595 |
| 590 int main(int argc, char** argv) { | 596 int main(int argc, char** argv) { |
| 591 return dart::bin::main(argc, argv); | 597 return dart::bin::main(argc, argv); |
| 592 } | 598 } |
| OLD | NEW |