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

Unified Diff: Source/heap/Handle.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: 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
Index: Source/heap/Handle.h
diff --git a/Source/heap/Handle.h b/Source/heap/Handle.h
index b175a9140fcdda2ac6c280f1916f416f5de6822b..d6bafcb7152dc76bbbf3bf99ec6373c2bc63bfb9 100644
--- a/Source/heap/Handle.h
+++ b/Source/heap/Handle.h
@@ -691,6 +691,15 @@ public:
{
}
+ template<typename U>
Mads Ager (chromium) 2013/08/16 10:23:41 We really shouldn't be using this unless we really
Erik Corry 2013/08/16 11:39:27 Done.
+ Result(const Member<U>* other)
+ : m_raw(other->raw())
+#ifndef NDEBUG
+ , m_doNotAllocate()
+#endif
+ {
+ }
+
~Result()
{
}
@@ -729,6 +738,13 @@ public:
return *this;
}
+ template<typename U>
+ Result& operator=(const Member<U>* other)
+ {
+ COMPILE_ASSERT(!sizeof(T*), Result_should_never_be_assigned_to);
+ return *this;
+ }
+
template<typename U> bool operator==(const U* other) const { return other == m_raw; }
template<typename U> bool operator!=(const U* other) const { return other != m_raw; }
@@ -814,6 +830,7 @@ private:
mutable NoAllocation m_doNotAllocate;
#endif
+ template<typename U> friend void Visitor::visit(const class Result<U>&);
template<typename U> friend class Persistent;
template<typename U> friend class Handle;
template<typename U> friend class Member;
@@ -1460,6 +1477,12 @@ template<typename T> struct HashTraits<WebCore::Member<T> > : SimpleClassHashTra
// the two types can be merged into PassInType.
typedef const typename WebCore::Handle<T>& PeekInType;
typedef const typename WebCore::Handle<T>& PassInType;
+ typedef WebCore::Result<T> IteratorGetType;
+ typedef WebCore::Result<T> IteratorConstGetType;
+ typedef WebCore::Result<T> IteratorReferenceType;
+ typedef WebCore::Result<T> IteratorConstReferenceType;
+ static IteratorReferenceType getToReferenceConversion(IteratorGetType x) { return x; }
+ static IteratorConstReferenceType getToReferenceConstConversion(IteratorConstGetType x) { return x; }
// FIXME(oilpan): Similarly, there is no need for a distinction between
// PeekType and PassOutType without reference counting.
typedef typename WebCore::Result<T> PeekType;

Powered by Google App Engine
This is Rietveld 408576698