Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: runtime/bin/gen_snapshot.cc

Issue 2440113003: Exit gen_snapshot and log an error if an output file path is invalid (Closed)
Patch Set: Exit gen_snapshot and log an error if an output file path is invalid Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } 375 }
376 376
377 return 0; 377 return 0;
378 } 378 }
379 379
380 380
381 static void WriteSnapshotFile(const char* filename, 381 static void WriteSnapshotFile(const char* filename,
382 const uint8_t* buffer, 382 const uint8_t* buffer,
383 const intptr_t size) { 383 const intptr_t size) {
384 File* file = File::Open(filename, File::kWriteTruncate); 384 File* file = File::Open(filename, File::kWriteTruncate);
385 ASSERT(file != NULL); 385 if (file == NULL) {
386 Log::PrintErr("Error: Unable to write snapshot file: %s\n\n", filename);
387 Dart_ExitScope();
388 Dart_ShutdownIsolate();
389 exit(kErrorExitCode);
390 }
386 if (!file->WriteFully(buffer, size)) { 391 if (!file->WriteFully(buffer, size)) {
387 Log::PrintErr("Error: Failed to write snapshot file.\n\n"); 392 Log::PrintErr("Error: Failed to write snapshot file.\n\n");
388 } 393 }
389 file->Release(); 394 file->Release();
390 } 395 }
391 396
392 397
393 class UriResolverIsolateScope { 398 class UriResolverIsolateScope {
394 public: 399 public:
395 UriResolverIsolateScope() { 400 UriResolverIsolateScope() {
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 EventHandler::Stop(); 1370 EventHandler::Stop();
1366 return 0; 1371 return 0;
1367 } 1372 }
1368 1373
1369 } // namespace bin 1374 } // namespace bin
1370 } // namespace dart 1375 } // namespace dart
1371 1376
1372 int main(int argc, char** argv) { 1377 int main(int argc, char** argv) {
1373 return dart::bin::main(argc, argv); 1378 return dart::bin::main(argc, argv);
1374 } 1379 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698