diff options
author | Mathieu Chartier <mathieuc@google.com> | 2013-09-18 00:33:00 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-18 00:33:01 +0000 |
commit | 8c7ec8cd8e39809ed31cb62bc3b068430042bd76 (patch) | |
tree | 0ef55b9099fab8a4216e06ce67655d38f7a43940 /runtime/intern_table.cc | |
parent | b307052d619ec757478951fc026e6230c92e3b36 (diff) | |
parent | 6aa3df965395566ed6a4fec4af37c2b7577992e9 (diff) | |
download | art-8c7ec8cd8e39809ed31cb62bc3b068430042bd76.zip art-8c7ec8cd8e39809ed31cb62bc3b068430042bd76.tar.gz art-8c7ec8cd8e39809ed31cb62bc3b068430042bd76.tar.bz2 |
Merge "Refactor system weak sweeping, add support for modification." into dalvik-dev
Diffstat (limited to 'runtime/intern_table.cc')
-rw-r--r-- | runtime/intern_table.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/runtime/intern_table.cc b/runtime/intern_table.cc index 472c92e..29d2ae9 100644 --- a/runtime/intern_table.cc +++ b/runtime/intern_table.cc @@ -197,14 +197,16 @@ bool InternTable::ContainsWeak(mirror::String* s) { return found == s; } -void InternTable::SweepInternTableWeaks(IsMarkedTester is_marked, void* arg) { +void InternTable::SweepInternTableWeaks(RootVisitor visitor, void* arg) { MutexLock mu(Thread::Current(), intern_table_lock_); - // TODO: std::remove_if + lambda. for (auto it = weak_interns_.begin(), end = weak_interns_.end(); it != end;) { mirror::Object* object = it->second; - if (!is_marked(object, arg)) { + mirror::Object* new_object = visitor(object, arg); + if (new_object == nullptr) { + // TODO: use it = weak_interns_.erase(it) when we get a c++11 stl. weak_interns_.erase(it++); } else { + it->second = down_cast<mirror::String*>(new_object); ++it; } } |