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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
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/Deque.h> |
34 #include <wtf/Forward.h> | 35 #include <wtf/Forward.h> |
35 #include <wtf/HashTraits.h> | 36 #include <wtf/HashTraits.h> |
36 #include <wtf/HashSet.h> | 37 #include <wtf/HashSet.h> |
37 | 38 |
38 namespace WebCore { | 39 namespace WebCore { |
39 | 40 |
40 template<typename T> class Member; | 41 template<typename T> class Member; |
41 | 42 |
42 #ifndef NDEBUG | 43 #ifndef NDEBUG |
43 #define DECLARE_GC_TYPE_MARKER \ | 44 #define DECLARE_GC_TYPE_MARKER \ |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 119 } |
119 | 120 |
120 template<typename T, size_t N> | 121 template<typename T, size_t N> |
121 void visit(const Vector<Member<T>, N>& vector) | 122 void visit(const Vector<Member<T>, N>& vector) |
122 { | 123 { |
123 for (typename Vector<Member<T>, N>::const_iterator it = vector.begin();
it != vector.end(); ++it) | 124 for (typename Vector<Member<T>, N>::const_iterator it = vector.begin();
it != vector.end(); ++it) |
124 visit(*it); | 125 visit(*it); |
125 } | 126 } |
126 | 127 |
127 template<typename T> | 128 template<typename T> |
128 void visit(const HashSet<Member<T> >& vector) | 129 void visit(const HashSet<Member<T> >& hashSet) |
129 { | 130 { |
130 for (typename HashSet<Member<T> >::const_iterator it = vector.begin(); i
t != vector.end(); ++it) | 131 for (typename HashSet<Member<T> >::const_iterator it = hashSet.begin();
it != hashSet.end(); ++it) |
131 visit(*it); | 132 visit(*it); |
132 } | 133 } |
133 | 134 |
| 135 template<typename T> |
| 136 void visit(const Deque<Member<T> >& deque) |
| 137 { |
| 138 for (typename Deque<Member<T> >::const_iterator it = deque.begin(); it !
= deque.end(); ++it) |
| 139 visit(*it); |
| 140 } |
| 141 |
134 // This method adds the object to the set of objects that should have their | 142 // This method adds the object to the set of objects that should have their |
135 // accept method called. Since not all objects have vtables we have to have | 143 // accept method called. Since not all objects have vtables we have to have |
136 // the callback as an explicit argument, but we can use the templated | 144 // the callback as an explicit argument, but we can use the templated |
137 // one-argument visit method above to automatically provide the callback | 145 // one-argument visit method above to automatically provide the callback |
138 // function. | 146 // function. |
139 virtual void visit(const void*, AcceptCallback) = 0; | 147 virtual void visit(const void*, AcceptCallback) = 0; |
140 | 148 |
141 // If the object calls this during the regular accept callback, then the | 149 // If the object calls this during the regular accept callback, then the |
142 // WeakPointerCallback argument may be called later, when the strong roots | 150 // WeakPointerCallback argument may be called later, when the strong roots |
143 // have all been found. The WeakPointerCallback will normally use isAlive | 151 // have all been found. The WeakPointerCallback will normally use isAlive |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 public: | 282 public: |
275 virtual void accept(Visitor*) = 0; | 283 virtual void accept(Visitor*) = 0; |
276 virtual ~HeapVisitable() | 284 virtual ~HeapVisitable() |
277 { | 285 { |
278 } | 286 } |
279 }; | 287 }; |
280 | 288 |
281 } | 289 } |
282 | 290 |
283 #endif | 291 #endif |
OLD | NEW |