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

Unified Diff: mojo/dart/embedder/dart_controller.cc

Issue 996923003: Dart: Better handle leak checks. close() is async. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix regexes Created 5 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 side-by-side diff with in-line comments
Download patch
Index: mojo/dart/embedder/dart_controller.cc
diff --git a/mojo/dart/embedder/dart_controller.cc b/mojo/dart/embedder/dart_controller.cc
index 6ffac3d5ea55b837e12333c3401939e980e4acde..f85e1c42a0ce489365c723543b2d6112f5a4e848 100644
--- a/mojo/dart/embedder/dart_controller.cc
+++ b/mojo/dart/embedder/dart_controller.cc
@@ -13,6 +13,7 @@
#include "mojo/dart/embedder/builtin.h"
#include "mojo/dart/embedder/dart_controller.h"
#include "mojo/dart/embedder/isolate_data.h"
+#include "mojo/public/c/system/core.h"
namespace mojo {
namespace dart {
@@ -429,6 +430,13 @@ static void UnhandledExceptionCallback(Dart_Handle error) {
// for clients if we pass any error string here instead.
isolate_data->callbacks.exception.Run(error);
}
+
+ // Close handles generated by the isolate.
+ std::set<int64_t>& handles = isolate_data->unclosed_handles;
+ for (auto it = handles.begin(); it != handles.end(); ++it) {
+ MojoClose(static_cast<MojoHandle>(*it));
+ }
+ handles.clear();
}

Powered by Google App Engine
This is Rietveld 408576698