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

Unified Diff: runtime/vm/dart_api_state.h

Issue 9413003: Thread the weak persistent handle free-list through the raw_ field. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge 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
« no previous file with comments | « no previous file | no next file » | 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 5b21db786f0566186697eb644003787aa5b78897..359dde6b846ca33d307e09067457102aa982c7fe 100644
--- a/runtime/vm/dart_api_state.h
+++ b/runtime/vm/dart_api_state.h
@@ -106,6 +106,7 @@ class PersistentHandle {
}
void SetNext(PersistentHandle* free_list) {
raw_ = reinterpret_cast<RawObject*>(free_list);
+ ASSERT(!raw_->IsHeapObject());
}
void FreeHandle(PersistentHandle* free_list) {
SetNext(free_list);
@@ -151,16 +152,16 @@ class WeakPersistentHandle {
WeakPersistentHandle() : raw_(NULL), peer_(NULL), callback_(NULL) { }
~WeakPersistentHandle() { }
- // Overload the callback_ field as a next pointer when adding freed
+ // Overload the raw_ field as a next pointer when adding freed
// handles to the free list.
WeakPersistentHandle* Next() {
- return reinterpret_cast<WeakPersistentHandle*>(callback_);
+ return reinterpret_cast<WeakPersistentHandle*>(raw_);
}
void SetNext(WeakPersistentHandle* free_list) {
- callback_ = reinterpret_cast<Dart_WeakPersistentHandleFinalizer>(free_list);
+ raw_ = reinterpret_cast<RawObject*>(free_list);
+ ASSERT(!raw_->IsHeapObject());
}
void FreeHandle(WeakPersistentHandle* free_list) {
- raw_ = NULL;
SetNext(free_list);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698