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

Unified Diff: runtime/vm/dart_api_state.h

Issue 1191443008: Assert no VM handles are created in the zone that belongs to a ApiNativeScopes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Descrease scopes, ASSERT on handle allocation Created 5 years, 6 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
« no previous file with comments | « no previous file | runtime/vm/handles.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_state.h
diff --git a/runtime/vm/dart_api_state.h b/runtime/vm/dart_api_state.h
index 2565bfe6bc41b7a686dceacd75539c00d9222318..4f2935409941f9de21e87234200e771d9a31995d 100644
--- a/runtime/vm/dart_api_state.h
+++ b/runtime/vm/dart_api_state.h
@@ -53,6 +53,12 @@ class ApiZone {
// Delete all memory associated with the zone.
~ApiZone() {
Isolate* isolate = Isolate::Current();
+#if defined(DEBUG)
+ if (isolate == NULL) {
+ ASSERT(zone_.handles()->CountScopedHandles() == 0);
+ ASSERT(zone_.handles()->CountZoneHandles() == 0);
+ }
+#endif
if ((isolate != NULL) && (isolate->current_zone() == &zone_)) {
isolate->set_current_zone(zone_.previous_);
}
@@ -636,7 +642,12 @@ class ApiNativeScope {
OSThread::GetThreadLocal(Api::api_native_key_));
}
- Zone* zone() { return zone_.GetZone(); }
+ Zone* zone() {
+ Zone* result = zone_.GetZone();
+ ASSERT(result->handles()->CountScopedHandles() == 0);
+ ASSERT(result->handles()->CountZoneHandles() == 0);
+ return result;
+ }
private:
ApiZone zone_;
« no previous file with comments | « no previous file | runtime/vm/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698