| 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::LoadSource(library, url, tag, builtin_lib); |
| 358 DartUtils::GetStringValue(file_path)); | 358 if (Dart_IsError(result)) { |
| 359 return result; |
| 360 } |
| 361 return Dart_RunLoop(); |
| 359 } | 362 } |
| 360 | 363 |
| 361 | 364 |
| 362 static Dart_Handle LoadSnapshotCreationScript(const char* script_name) { | 365 static Dart_Handle LoadSnapshotCreationScript(const char* script_name) { |
| 363 Dart_Handle resolved_script_uri = ResolveScriptUri(script_name); | 366 Dart_Handle resolved_script_uri = ResolveScriptUri(script_name); |
| 364 if (Dart_IsError(resolved_script_uri)) { | 367 if (Dart_IsError(resolved_script_uri)) { |
| 365 return resolved_script_uri; | 368 return resolved_script_uri; |
| 366 } | 369 } |
| 367 Dart_Handle script_path = FilePathFromUri( | 370 Dart_Handle script_path = FilePathFromUri( |
| 368 DartUtils::GetStringValue(resolved_script_uri)); | 371 DartUtils::GetStringValue(resolved_script_uri)); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 586 } |
| 584 return 0; | 587 return 0; |
| 585 } | 588 } |
| 586 | 589 |
| 587 } // namespace bin | 590 } // namespace bin |
| 588 } // namespace dart | 591 } // namespace dart |
| 589 | 592 |
| 590 int main(int argc, char** argv) { | 593 int main(int argc, char** argv) { |
| 591 return dart::bin::main(argc, argv); | 594 return dart::bin::main(argc, argv); |
| 592 } | 595 } |
| OLD | NEW |