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

Side by Side Diff: runtime/bin/exit.h

Issue 2681193002: Factor out snapshot helpers from main.cc. (Closed)
Patch Set: . Created 3 years, 10 months 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
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
zra 2017/02/09 16:15:38 2017
rmacnak 2017/02/10 02:11:56 Done.
rmacnak 2017/02/10 02:11:56 Done.
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.
4
5 #ifndef RUNTIME_BIN_EXIT_H_
6 #define RUNTIME_BIN_EXIT_H_
7
8 #include "bin/log.h"
9 #include "bin/platform.h"
10 #include "bin/process.h"
11 #include "bin/eventhandler.h"
12 #include "include/dart_api.h"
13 #include "platform/assert.h"
14 #include "platform/globals.h"
15
16 namespace dart {
17 namespace bin {
18
19 // Exit code indicating an internal Dart Frontend error.
20 static const int kDartFrontendErrorExitCode = 252;
21 // Exit code indicating an API error.
22 static const int kApiErrorExitCode = 253;
23 // Exit code indicating a compilation error.
24 static const int kCompilationErrorExitCode = 254;
25 // Exit code indicating an unhandled error that is not a compilation error.
26 static const int kErrorExitCode = 255;
27 // Exit code indicating a vm restart request. Never returned to the user.
28 static const int kRestartRequestExitCode = 1000;
29
30 static void ErrorExit(int exit_code, const char* format, ...) {
zra 2017/02/09 16:15:38 Maybe rename this file error_exit.h and make a .cc
rmacnak 2017/02/10 02:11:56 Done.
31 va_list arguments;
32 va_start(arguments, format);
33 Log::VPrintErr(format, arguments);
34 va_end(arguments);
35
36 Dart_ExitScope();
37 Dart_ShutdownIsolate();
38
39 // Terminate process exit-code handler.
40 Process::TerminateExitCodeHandler();
41
42 char* error = Dart_Cleanup();
43 if (error != NULL) {
44 Log::PrintErr("VM cleanup failed: %s\n", error);
45 free(error);
46 }
47
48 EventHandler::Stop();
49 Platform::Exit(exit_code);
50 }
51
52 } // namespace bin
53 } // namespace dart
54
55 #endif // RUNTIME_BIN_EXIT_H_
OLDNEW
« no previous file with comments | « runtime/bin/bin.gypi ('k') | runtime/bin/main.cc » ('j') | runtime/bin/snapshot.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698