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

Unified Diff: runtime/vm/handles_impl.h

Issue 8984006: Implement weak persistent handles in the Dart API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 9 years 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/handles_impl.h
diff --git a/runtime/vm/handles_impl.h b/runtime/vm/handles_impl.h
index 64abd942c0abe9b64611a38ed7363457f256aed9..9d82cd35001380b068253784b23eca8474fad807 100644
--- a/runtime/vm/handles_impl.h
+++ b/runtime/vm/handles_impl.h
@@ -30,6 +30,26 @@ void Handles<kHandleSizeInWords,
}
+template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
+void Handles<kHandleSizeInWords,
+ kHandlesPerChunk,
+ kOffsetOfRawPtr>::Visit(HandleVisitor* visitor) {
+ // Visit all zone handles.
+ HandlesBlock* block = zone_blocks_;
+ while (block != NULL) {
+ block->Visit(visitor);
+ block = block->next_block();
+ }
+
+ // Visit all scoped handles.
+ block = &first_scoped_block_;
+ do {
+ block->Visit(visitor);
+ block = block->next_block();
+ } while (block != NULL);
+}
+
+
// Figure out the current handle scope using the current Isolate and
// allocate a handle in that scope. The function assumes that a
// current Isolate, current zone and current handle scope exist. It
@@ -283,6 +303,17 @@ void Handles<kHandleSizeInWords,
}
+template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
+void Handles<kHandleSizeInWords,
+ kHandlesPerChunk,
+ kOffsetOfRawPtr>::HandlesBlock::Visit(HandleVisitor* visitor) {
+ ASSERT(visitor != NULL);
+ for (intptr_t i = 0; i < next_handle_slot_; i += kHandleSizeInWords) {
+ visitor->Visit(&data_[i + kOffsetOfRawPtr/kWordSize]);
+ }
+}
+
+
#if defined(DEBUG)
template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
void Handles<kHandleSizeInWords,
« runtime/include/dart_api.h ('K') | « runtime/vm/handles.h ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698