Index: runtime/vm/gc_marker.cc |
diff --git a/runtime/vm/gc_marker.cc b/runtime/vm/gc_marker.cc |
index 0b302cec79fb011d8c5dfc97364e0fdbf52646e5..069f34175990a492b4c75280f2062e1e58ad0153 100644 |
--- a/runtime/vm/gc_marker.cc |
+++ b/runtime/vm/gc_marker.cc |
@@ -422,21 +422,19 @@ static bool IsUnreachable(const RawObject* raw_obj) { |
class MarkingWeakVisitor : public HandleVisitor { |
public: |
- MarkingWeakVisitor(Thread* thread, FinalizationQueue* queue) : |
- HandleVisitor(thread), queue_(queue) { } |
+ MarkingWeakVisitor() : HandleVisitor(Thread::Current()) { |
+ } |
void VisitHandle(uword addr) { |
FinalizablePersistentHandle* handle = |
reinterpret_cast<FinalizablePersistentHandle*>(addr); |
RawObject* raw_obj = handle->raw(); |
if (IsUnreachable(raw_obj)) { |
- handle->UpdateUnreachable(thread()->isolate(), queue_); |
+ handle->UpdateUnreachable(thread()->isolate()); |
} |
} |
private: |
- FinalizationQueue* queue_; |
- |
DISALLOW_COPY_AND_ASSIGN(MarkingWeakVisitor); |
}; |
@@ -670,14 +668,8 @@ void GCMarker::MarkObjects(Isolate* isolate, |
mark.DrainMarkingStack(); |
{ |
TIMELINE_FUNCTION_GC_DURATION(thread, "WeakHandleProcessing"); |
- FinalizationQueue* queue = new FinalizationQueue(); |
- MarkingWeakVisitor mark_weak(thread, queue); |
+ MarkingWeakVisitor mark_weak; |
IterateWeakRoots(isolate, &mark_weak); |
- if (queue->length() > 0) { |
- Dart::thread_pool()->Run(new BackgroundFinalizer(isolate, queue)); |
- } else { |
- delete queue; |
- } |
} |
// All marking done; detach code, etc. |
FinalizeResultsFrom(&mark); |
@@ -701,14 +693,8 @@ void GCMarker::MarkObjects(Isolate* isolate, |
// Phase 2: Weak processing on main thread. |
{ |
TIMELINE_FUNCTION_GC_DURATION(thread, "WeakHandleProcessing"); |
- FinalizationQueue* queue = new FinalizationQueue(); |
- MarkingWeakVisitor mark_weak(thread, queue); |
+ MarkingWeakVisitor mark_weak; |
IterateWeakRoots(isolate, &mark_weak); |
- if (queue->length() > 0) { |
- Dart::thread_pool()->Run(new BackgroundFinalizer(isolate, queue)); |
- } else { |
- delete queue; |
- } |
} |
barrier.Sync(); |