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

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: 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/core/inspector/InspectorDOMAgent.cpp ('k') | Source/heap/Visitor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/heap/Handle.h
diff --git a/Source/heap/Handle.h b/Source/heap/Handle.h
index 63e44b360a5ebbf04442ff999e426fae246870e7..d8d0f5fae4377f30cb45e0a54212a96ad4104855 100644
--- a/Source/heap/Handle.h
+++ b/Source/heap/Handle.h
@@ -40,6 +40,12 @@
#include <wtf/TypeTraits.h>
#include <wtf/Vector.h>
+namespace WTF {
+
+template<typename A, typename B, typename C, typename D, typename E, typename F, typename G> class HashTableConstIterator;
+
+}
+
namespace WebCore {
// Forward declarations.
@@ -759,6 +765,22 @@ public:
Handle<T> handle() const { return Handle<T>(releaseRaw()); }
private:
+ template<typename U>
+ Result(const Member<U>* other)
+ : m_raw(other->raw())
+#ifndef NDEBUG
+ , m_doNotAllocate()
+#endif
+ {
+ }
+
+ template<typename U>
+ Result& operator=(const Member<U>* other)
+ {
+ COMPILE_ASSERT(!sizeof(T*), Result_should_never_be_assigned_to);
+ return *this;
+ }
+
explicit Result(T* raw)
: m_raw(raw)
#ifndef NDEBUG
@@ -785,6 +807,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;
@@ -810,6 +833,7 @@ private:
template<typename U, typename V> friend bool operator!=(const Result<U>&, const V*);
template<typename U, typename V> friend bool operator==(const U*, const Result<V>&);
template<typename U, typename V> friend bool operator!=(const U*, const Result<V>&);
+ template<typename A, typename B, typename C, typename D, typename E, typename F, typename G> friend class WTF::HashTableConstIterator;
};
template<class T>
@@ -1353,6 +1377,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;
« no previous file with comments | « Source/core/inspector/InspectorDOMAgent.cpp ('k') | Source/heap/Visitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698