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 <stdio.h> | 8 #include <stdio.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 376 |
377 | 377 |
378 static void WriteSnapshotFile(const char* filename, | 378 static void WriteSnapshotFile(const char* filename, |
379 const uint8_t* buffer, | 379 const uint8_t* buffer, |
380 const intptr_t size) { | 380 const intptr_t size) { |
381 File* file = File::Open(filename, File::kWriteTruncate); | 381 File* file = File::Open(filename, File::kWriteTruncate); |
382 if (file == NULL) { | 382 if (file == NULL) { |
383 Log::PrintErr("Error: Unable to write snapshot file: %s\n\n", filename); | 383 Log::PrintErr("Error: Unable to write snapshot file: %s\n\n", filename); |
384 Dart_ExitScope(); | 384 Dart_ExitScope(); |
385 Dart_ShutdownIsolate(); | 385 Dart_ShutdownIsolate(); |
| 386 Dart_Cleanup(); |
386 exit(kErrorExitCode); | 387 exit(kErrorExitCode); |
387 } | 388 } |
388 if (!file->WriteFully(buffer, size)) { | 389 if (!file->WriteFully(buffer, size)) { |
389 Log::PrintErr("Error: Failed to write snapshot file.\n\n"); | 390 Log::PrintErr("Error: Failed to write snapshot file.\n\n"); |
390 } | 391 } |
391 file->Release(); | 392 file->Release(); |
392 } | 393 } |
393 | 394 |
394 | 395 |
395 class UriResolverIsolateScope { | 396 class UriResolverIsolateScope { |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 EventHandler::Stop(); | 1372 EventHandler::Stop(); |
1372 return 0; | 1373 return 0; |
1373 } | 1374 } |
1374 | 1375 |
1375 } // namespace bin | 1376 } // namespace bin |
1376 } // namespace dart | 1377 } // namespace dart |
1377 | 1378 |
1378 int main(int argc, char** argv) { | 1379 int main(int argc, char** argv) { |
1379 return dart::bin::main(argc, argv); | 1380 return dart::bin::main(argc, argv); |
1380 } | 1381 } |
OLD | NEW |