| 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef Visitor_h | 31 #ifndef Visitor_h |
| 32 #define Visitor_h | 32 #define Visitor_h |
| 33 | 33 |
| 34 #include <wtf/Forward.h> | 34 #include <wtf/Forward.h> |
| 35 #include <wtf/HashSet.h> |
| 35 | 36 |
| 36 namespace WebCore { | 37 namespace WebCore { |
| 37 | 38 |
| 38 template<typename T> class Member; | 39 template<typename T> class Member; |
| 39 | 40 |
| 40 #ifndef NDEBUG | 41 #ifndef NDEBUG |
| 41 #define DECLARE_GC_TYPE_MARKER \ | 42 #define DECLARE_GC_TYPE_MARKER \ |
| 42 public: \ | 43 public: \ |
| 43 static const char* s_gcTypeMarker; \ | 44 static const char* s_gcTypeMarker; \ |
| 44 private: \ | 45 private: \ |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 AcceptTrait<T>::visit(this, t.raw()); | 112 AcceptTrait<T>::visit(this, t.raw()); |
| 112 } | 113 } |
| 113 | 114 |
| 114 template<typename T> | 115 template<typename T> |
| 115 void visit(const Vector<Member<T> >& vector) | 116 void visit(const Vector<Member<T> >& vector) |
| 116 { | 117 { |
| 117 for (typename Vector<Member<T> >::const_iterator it = vector.begin(); it
!= vector.end(); ++it) | 118 for (typename Vector<Member<T> >::const_iterator it = vector.begin(); it
!= vector.end(); ++it) |
| 118 visit(*it); | 119 visit(*it); |
| 119 } | 120 } |
| 120 | 121 |
| 122 template<typename T, size_t N> |
| 123 void visit(const Vector<Member<T>, N>& vector) |
| 124 { |
| 125 for (typename Vector<Member<T> >::const_iterator it = vector.begin(); it
!= vector.end(); ++it) |
| 126 visit(*it); |
| 127 } |
| 128 |
| 129 template<typename T> |
| 130 void visit(const HashSet<Member<T> >& vector) |
| 131 { |
| 132 for (typename HashSet<Member<T> >::const_iterator it = vector.begin(); i
t != vector.end(); ++it) |
| 133 visit(*it); |
| 134 } |
| 135 |
| 121 // This method adds the object to the set of objects that should have their | 136 // This method adds the object to the set of objects that should have their |
| 122 // accept method called. Since not all objects have vtables we have to have | 137 // accept method called. Since not all objects have vtables we have to have |
| 123 // the callback as an explicit argument, but we can use the templated | 138 // the callback as an explicit argument, but we can use the templated |
| 124 // one-argument visit method above to automatically provide the callback | 139 // one-argument visit method above to automatically provide the callback |
| 125 // function. | 140 // function. |
| 126 virtual void visit(const void*, AcceptCallback) = 0; | 141 virtual void visit(const void*, AcceptCallback) = 0; |
| 127 | 142 |
| 128 // If the object calls this during the regular accept callback, then the | 143 // If the object calls this during the regular accept callback, then the |
| 129 // WeakPointerCallback argument may be called later, when the strong roots | 144 // WeakPointerCallback argument may be called later, when the strong roots |
| 130 // have all been found. The WeakPointerCallback will normally use isAlive | 145 // have all been found. The WeakPointerCallback will normally use isAlive |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 public: | 276 public: |
| 262 virtual void accept(Visitor*) = 0; | 277 virtual void accept(Visitor*) = 0; |
| 263 virtual ~HeapVisitable() | 278 virtual ~HeapVisitable() |
| 264 { | 279 { |
| 265 } | 280 } |
| 266 }; | 281 }; |
| 267 | 282 |
| 268 } | 283 } |
| 269 | 284 |
| 270 #endif | 285 #endif |
| OLD | NEW |