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

Unified Diff: Source/heap/Visitor.h

Issue 23042005: [oilpan] Fix iterators over member collections to return Result<T> (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Rebase Created 7 years, 4 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 | « Source/heap/Handle.h ('k') | Source/heap/tests/HeapTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/heap/Visitor.h
diff --git a/Source/heap/Visitor.h b/Source/heap/Visitor.h
index 06c4c1ac5fb2e652479cdfeeceafaf5c46e3cc56..47aecf6ec866301a99bed42ba7cdc0aa3f524db3 100644
--- a/Source/heap/Visitor.h
+++ b/Source/heap/Visitor.h
@@ -39,6 +39,7 @@
namespace WebCore {
template<typename T> class Member;
+template<typename T> class Result;
#ifndef NDEBUG
#define DECLARE_GC_TYPE_MARKER \
@@ -118,6 +119,21 @@ public:
AcceptTrait<T>::visit(this, t.raw());
}
+ // Result version of the one-argument templated visit method. This is used
+ // for visiting collections: The iterator returns Result<T> and we visit
+ // them. This visitor method is befriended by Result<T> which allows it to
+ // use releaseRaw.
+ template<typename T>
+ void visit(const Result<T>& t)
+ {
+ if (!t)
+ return;
+#ifndef NDEBUG
+ AcceptTrait<T>::check(this, t.releaseRaw());
+#endif
+ AcceptTrait<T>::visit(this, t.releaseRaw());
+ }
+
template<typename T, size_t N>
void visit(const Vector<Member<T>, N>& vector)
{
« no previous file with comments | « Source/heap/Handle.h ('k') | Source/heap/tests/HeapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698