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

Unified Diff: runtime/vm/object.cc

Issue 205153002: Auto delete persistent weak handles during finalization after invoking the callback associated with… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 34115)
+++ runtime/vm/object.cc (working copy)
@@ -420,18 +420,6 @@
}
-static void DeleteWeakPersistentHandle(Dart_Isolate current_isolate,
- Dart_WeakPersistentHandle handle) {
- Isolate* isolate = reinterpret_cast<Isolate*>(current_isolate);
- ApiState* state = isolate->api_state();
- ASSERT(state != NULL);
- FinalizablePersistentHandle* weak_ref =
- reinterpret_cast<FinalizablePersistentHandle*>(handle);
- ASSERT(state->IsValidWeakPersistentHandle(handle));
- state->weak_persistent_handles().FreeHandle(weak_ref);
-}
-
-
void Object::InitOnce() {
// TODO(iposva): NoGCScope needs to be added here.
ASSERT(class_class() == null_);
@@ -6753,12 +6741,11 @@
}
-void TokenStream::DataFinalizer(Dart_Isolate isolate,
+void TokenStream::DataFinalizer(void* isolate_callback_data,
Dart_WeakPersistentHandle handle,
void *peer) {
ASSERT(peer != NULL);
::free(peer);
- DeleteWeakPersistentHandle(isolate, handle);
}
@@ -16118,11 +16105,10 @@
}
-void OneByteString::Finalize(Dart_Isolate isolate,
+void OneByteString::Finalize(void* isolate_callback_data,
Dart_WeakPersistentHandle handle,
void* peer) {
delete reinterpret_cast<ExternalStringData<uint8_t>*>(peer);
- DeleteWeakPersistentHandle(isolate, handle);
}
@@ -16294,11 +16280,10 @@
}
-void TwoByteString::Finalize(Dart_Isolate isolate,
+void TwoByteString::Finalize(void* isolate_callback_data,
Dart_WeakPersistentHandle handle,
void* peer) {
delete reinterpret_cast<ExternalStringData<uint16_t>*>(peer);
- DeleteWeakPersistentHandle(isolate, handle);
}
@@ -16333,11 +16318,10 @@
}
-void ExternalOneByteString::Finalize(Dart_Isolate isolate,
+void ExternalOneByteString::Finalize(void* isolate_callback_data,
Dart_WeakPersistentHandle handle,
void* peer) {
delete reinterpret_cast<ExternalStringData<uint8_t>*>(peer);
- DeleteWeakPersistentHandle(isolate, handle);
}
@@ -16372,11 +16356,10 @@
}
-void ExternalTwoByteString::Finalize(Dart_Isolate isolate,
+void ExternalTwoByteString::Finalize(void* isolate_callback_data,
Dart_WeakPersistentHandle handle,
void* peer) {
delete reinterpret_cast<ExternalStringData<uint16_t>*>(peer);
- DeleteWeakPersistentHandle(isolate, handle);
}
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698