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

Unified Diff: runtime/bin/error_exit.cc

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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/error_exit.cc
diff --git a/runtime/bin/error_exit.cc b/runtime/bin/error_exit.cc
new file mode 100644
index 0000000000000000000000000000000000000000..191a8e516894c6b155a8aba23593daa2ba38886f
--- /dev/null
+++ b/runtime/bin/error_exit.cc
@@ -0,0 +1,41 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "bin/error_exit.h"
+
+#include "bin/log.h"
+#include "bin/platform.h"
+#include "bin/process.h"
+#include "bin/eventhandler.h"
zra 2017/02/10 15:42:34 alphabetize.
rmacnak 2017/02/13 19:17:03 Done.
+#include "include/dart_api.h"
+#include "platform/assert.h"
+#include "platform/globals.h"
+
+namespace dart {
+namespace bin {
+
+void ErrorExit(int exit_code, const char* format, ...) {
+ va_list arguments;
+ va_start(arguments, format);
+ Log::VPrintErr(format, arguments);
+ va_end(arguments);
+
+ Dart_ExitScope();
+ Dart_ShutdownIsolate();
+
+ // Terminate process exit-code handler.
+ Process::TerminateExitCodeHandler();
+
+ char* error = Dart_Cleanup();
+ if (error != NULL) {
+ Log::PrintErr("VM cleanup failed: %s\n", error);
+ free(error);
+ }
+
+ EventHandler::Stop();
+ Platform::Exit(exit_code);
+}
+
+} // namespace bin
+} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698