| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 AcceptTrait<T>::visit(this, t.raw()); | 114 AcceptTrait<T>::visit(this, t.raw()); |
| 114 } | 115 } |
| 115 | 116 |
| 116 template<typename T> | 117 template<typename T> |
| 117 void visit(const Vector<Member<T> >& vector) | 118 void visit(const Vector<Member<T> >& vector) |
| 118 { | 119 { |
| 119 for (typename Vector<Member<T> >::const_iterator it = vector.begin(); it
!= vector.end(); ++it) | 120 for (typename Vector<Member<T> >::const_iterator it = vector.begin(); it
!= vector.end(); ++it) |
| 120 visit(*it); | 121 visit(*it); |
| 121 } | 122 } |
| 122 | 123 |
| 124 template<typename T, size_t N> |
| 125 void visit(const Vector<Member<T>, N>& vector) |
| 126 { |
| 127 for (typename Vector<Member<T> >::const_iterator it = vector.begin(); it
!= vector.end(); ++it) |
| 128 visit(*it); |
| 129 } |
| 130 |
| 131 template<typename T> |
| 132 void visit(const HashSet<Member<T> >& vector) |
| 133 { |
| 134 for (typename HashSet<Member<T> >::const_iterator it = vector.begin(); i
t != vector.end(); ++it) |
| 135 visit(*it); |
| 136 } |
| 137 |
| 123 // This method adds the object to the set of objects that should have their | 138 // This method adds the object to the set of objects that should have their |
| 124 // accept method called. Since not all objects have vtables we have to have | 139 // accept method called. Since not all objects have vtables we have to have |
| 125 // the callback as an explicit argument, but we can use the templated | 140 // the callback as an explicit argument, but we can use the templated |
| 126 // one-argument visit method above to automatically provide the callback | 141 // one-argument visit method above to automatically provide the callback |
| 127 // function. | 142 // function. |
| 128 virtual void visit(const void*, AcceptCallback) = 0; | 143 virtual void visit(const void*, AcceptCallback) = 0; |
| 129 | 144 |
| 130 // If the object calls this during the regular accept callback, then the | 145 // If the object calls this during the regular accept callback, then the |
| 131 // WeakPointerCallback argument may be called later, when the strong roots | 146 // WeakPointerCallback argument may be called later, when the strong roots |
| 132 // have all been found. The WeakPointerCallback will normally use isAlive | 147 // have all been found. The WeakPointerCallback will normally use isAlive |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 public: | 278 public: |
| 264 virtual void accept(Visitor*) = 0; | 279 virtual void accept(Visitor*) = 0; |
| 265 virtual ~HeapVisitable() | 280 virtual ~HeapVisitable() |
| 266 { | 281 { |
| 267 } | 282 } |
| 268 }; | 283 }; |
| 269 | 284 |
| 270 } | 285 } |
| 271 | 286 |
| 272 #endif | 287 #endif |
| OLD | NEW |