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

Unified Diff: runtime/vm/dart_api_state.h

Issue 9368049: Add external byte array API and finalize external strings and byte arrays. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix simarm and other minor changes Created 8 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/vm/dart_api_state.h
diff --git a/runtime/vm/dart_api_state.h b/runtime/vm/dart_api_state.h
index 9badcc4fb9447228d1ad0ca6c148d081686b6f06..942473ea407f1fc499305cd64205e53cbf496d5d 100644
--- a/runtime/vm/dart_api_state.h
+++ b/runtime/vm/dart_api_state.h
@@ -127,11 +127,15 @@ class WeakPersistentHandle {
Dart_PeerFinalizer callback() const { return callback_; }
void set_callback(Dart_PeerFinalizer callback) { callback_ = callback; }
- void Finalize() {
- if (callback_ != NULL) {
- (*callback_)(peer_);
+ static void Finalize(WeakPersistentHandle* handle) {
+ if (handle->callback() != NULL) {
+ Dart_PeerFinalizer callback = handle->callback();
+ void* peer = handle->peer();
+ handle->Clear();
+ (*callback)(reinterpret_cast<Dart_Handle>(handle), peer);
+ } else {
+ handle->Clear();
}
- Clear();
}
private:

Powered by Google App Engine
This is Rietveld 408576698