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

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

Issue 2760293002: [dart:io] Adds a finalizer to _NativeSocket to avoid socket leaks (Closed)
Patch Set: Add asserts Created 3 years, 9 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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 #include "include/dart_tools_api.h" 10 #include "include/dart_tools_api.h"
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 delete[] isolate_name; 1249 delete[] isolate_name;
1250 Log::PrintErr("%s\n", error); 1250 Log::PrintErr("%s\n", error);
1251 free(error); 1251 free(error);
1252 error = NULL; 1252 error = NULL;
1253 Process::TerminateExitCodeHandler(); 1253 Process::TerminateExitCodeHandler();
1254 error = Dart_Cleanup(); 1254 error = Dart_Cleanup();
1255 if (error != NULL) { 1255 if (error != NULL) {
1256 Log::PrintErr("VM cleanup failed: %s\n", error); 1256 Log::PrintErr("VM cleanup failed: %s\n", error);
1257 free(error); 1257 free(error);
1258 } 1258 }
1259 Process::ClearAllSignalHandlers();
1259 EventHandler::Stop(); 1260 EventHandler::Stop();
1260 Platform::Exit((exit_code != 0) ? exit_code : kErrorExitCode); 1261 Platform::Exit((exit_code != 0) ? exit_code : kErrorExitCode);
1261 } 1262 }
1262 main_isolate = isolate; 1263 main_isolate = isolate;
1263 delete[] isolate_name; 1264 delete[] isolate_name;
1264 1265
1265 Dart_EnterIsolate(isolate); 1266 Dart_EnterIsolate(isolate);
1266 ASSERT(isolate == Dart_CurrentIsolate()); 1267 ASSERT(isolate == Dart_CurrentIsolate());
1267 ASSERT(isolate != NULL); 1268 ASSERT(isolate != NULL);
1268 Dart_Handle result; 1269 Dart_Handle result;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 } 1637 }
1637 1638
1638 // Terminate process exit-code handler. 1639 // Terminate process exit-code handler.
1639 Process::TerminateExitCodeHandler(); 1640 Process::TerminateExitCodeHandler();
1640 1641
1641 error = Dart_Cleanup(); 1642 error = Dart_Cleanup();
1642 if (error != NULL) { 1643 if (error != NULL) {
1643 Log::PrintErr("VM cleanup failed: %s\n", error); 1644 Log::PrintErr("VM cleanup failed: %s\n", error);
1644 free(error); 1645 free(error);
1645 } 1646 }
1647 Process::ClearAllSignalHandlers();
1646 EventHandler::Stop(); 1648 EventHandler::Stop();
1647 1649
1648 delete app_snapshot; 1650 delete app_snapshot;
1649 free(app_script_uri); 1651 free(app_script_uri);
1650 1652
1651 // Free copied argument strings if converted. 1653 // Free copied argument strings if converted.
1652 if (argv_converted) { 1654 if (argv_converted) {
1653 for (int i = 0; i < argc; i++) { 1655 for (int i = 0; i < argc; i++) {
1654 free(argv[i]); 1656 free(argv[i]);
1655 } 1657 }
(...skipping 12 matching lines...) Expand all
1668 Platform::Exit(Process::GlobalExitCode()); 1670 Platform::Exit(Process::GlobalExitCode());
1669 } 1671 }
1670 1672
1671 } // namespace bin 1673 } // namespace bin
1672 } // namespace dart 1674 } // namespace dart
1673 1675
1674 int main(int argc, char** argv) { 1676 int main(int argc, char** argv) {
1675 dart::bin::main(argc, argv); 1677 dart::bin::main(argc, argv);
1676 UNREACHABLE(); 1678 UNREACHABLE();
1677 } 1679 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698