| 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(); |  | 
| 387     exit(kErrorExitCode); | 386     exit(kErrorExitCode); | 
| 388   } | 387   } | 
| 389   if (!file->WriteFully(buffer, size)) { | 388   if (!file->WriteFully(buffer, size)) { | 
| 390     Log::PrintErr("Error: Failed to write snapshot file.\n\n"); | 389     Log::PrintErr("Error: Failed to write snapshot file.\n\n"); | 
| 391   } | 390   } | 
| 392   file->Release(); | 391   file->Release(); | 
| 393 } | 392 } | 
| 394 | 393 | 
| 395 | 394 | 
| 396 class UriResolverIsolateScope { | 395 class UriResolverIsolateScope { | 
| (...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1372   EventHandler::Stop(); | 1371   EventHandler::Stop(); | 
| 1373   return 0; | 1372   return 0; | 
| 1374 } | 1373 } | 
| 1375 | 1374 | 
| 1376 }  // namespace bin | 1375 }  // namespace bin | 
| 1377 }  // namespace dart | 1376 }  // namespace dart | 
| 1378 | 1377 | 
| 1379 int main(int argc, char** argv) { | 1378 int main(int argc, char** argv) { | 
| 1380   return dart::bin::main(argc, argv); | 1379   return dart::bin::main(argc, argv); | 
| 1381 } | 1380 } | 
| OLD | NEW | 
|---|