| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #define Visitor_h | 32 #define Visitor_h |
| 33 | 33 |
| 34 #include <wtf/Deque.h> | 34 #include <wtf/Deque.h> |
| 35 #include <wtf/Forward.h> | 35 #include <wtf/Forward.h> |
| 36 #include <wtf/HashTraits.h> | 36 #include <wtf/HashTraits.h> |
| 37 #include <wtf/HashSet.h> | 37 #include <wtf/HashSet.h> |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 template<typename T> class Member; | 41 template<typename T> class Member; |
| 42 template<typename T> class Result; |
| 42 | 43 |
| 43 #ifndef NDEBUG | 44 #ifndef NDEBUG |
| 44 #define DECLARE_GC_TYPE_MARKER \ | 45 #define DECLARE_GC_TYPE_MARKER \ |
| 45 public: \ | 46 public: \ |
| 46 static const char* s_gcTypeMarker; \ | 47 static const char* s_gcTypeMarker; \ |
| 47 private: \ | 48 private: \ |
| 48 | 49 |
| 49 #define DEFINE_GC_TYPE_MARKER(type) const char* type::s_gcTypeMarker = #type | 50 #define DEFINE_GC_TYPE_MARKER(type) const char* type::s_gcTypeMarker = #type |
| 50 #else | 51 #else |
| 51 #define DECLARE_GC_TYPE_MARKER | 52 #define DECLARE_GC_TYPE_MARKER |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 void visit(const Member<T>& t) | 112 void visit(const Member<T>& t) |
| 112 { | 113 { |
| 113 if (!t) | 114 if (!t) |
| 114 return; | 115 return; |
| 115 #ifndef NDEBUG | 116 #ifndef NDEBUG |
| 116 AcceptTrait<T>::check(this, t.raw()); | 117 AcceptTrait<T>::check(this, t.raw()); |
| 117 #endif | 118 #endif |
| 118 AcceptTrait<T>::visit(this, t.raw()); | 119 AcceptTrait<T>::visit(this, t.raw()); |
| 119 } | 120 } |
| 120 | 121 |
| 122 // Result version of the one-argument templated visit method. This is used |
| 123 // for visiting collections: The iterator returns Result<T> and we visit |
| 124 // them. This visitor method is befriended by Result<T> which allows it to |
| 125 // use releaseRaw. |
| 126 template<typename T> |
| 127 void visit(const Result<T>& t) |
| 128 { |
| 129 if (!t) |
| 130 return; |
| 131 #ifndef NDEBUG |
| 132 AcceptTrait<T>::check(this, t.releaseRaw()); |
| 133 #endif |
| 134 AcceptTrait<T>::visit(this, t.releaseRaw()); |
| 135 } |
| 136 |
| 121 template<typename T, size_t N> | 137 template<typename T, size_t N> |
| 122 void visit(const Vector<Member<T>, N>& vector) | 138 void visit(const Vector<Member<T>, N>& vector) |
| 123 { | 139 { |
| 124 for (typename Vector<Member<T>, N>::const_iterator it = vector.begin();
it != vector.end(); ++it) | 140 for (typename Vector<Member<T>, N>::const_iterator it = vector.begin();
it != vector.end(); ++it) |
| 125 visit(*it); | 141 visit(*it); |
| 126 } | 142 } |
| 127 | 143 |
| 128 template<typename T> | 144 template<typename T> |
| 129 void visit(const HashSet<Member<T> >& hashSet) | 145 void visit(const HashSet<Member<T> >& hashSet) |
| 130 { | 146 { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 public: | 298 public: |
| 283 virtual void accept(Visitor*) = 0; | 299 virtual void accept(Visitor*) = 0; |
| 284 virtual ~HeapVisitable() | 300 virtual ~HeapVisitable() |
| 285 { | 301 { |
| 286 } | 302 } |
| 287 }; | 303 }; |
| 288 | 304 |
| 289 } | 305 } |
| 290 | 306 |
| 291 #endif | 307 #endif |
| OLD | NEW |