Chromium Code Reviews| 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. | |
|
Mads Ager (chromium)
2013/08/16 10:23:41
Could you expand the comment here to state why thi
Erik Corry
2013/08/16 11:39:27
Done.
| |
| 123 template<typename T> | |
| 124 void visit(const Result<T>& t) | |
| 125 { | |
| 126 if (!t) | |
| 127 return; | |
| 128 #ifndef NDEBUG | |
| 129 AcceptTrait<T>::check(this, t.releaseRaw()); | |
| 130 #endif | |
| 131 AcceptTrait<T>::visit(this, t.releaseRaw()); | |
| 132 } | |
| 133 | |
| 121 template<typename T, size_t N> | 134 template<typename T, size_t N> |
| 122 void visit(const Vector<Member<T>, N>& vector) | 135 void visit(const Vector<Member<T>, N>& vector) |
| 123 { | 136 { |
| 124 for (typename Vector<Member<T>, N>::const_iterator it = vector.begin(); it != vector.end(); ++it) | 137 for (typename Vector<Member<T>, N>::const_iterator it = vector.begin(); it != vector.end(); ++it) |
| 125 visit(*it); | 138 visit(*it); |
| 126 } | 139 } |
| 127 | 140 |
| 128 template<typename T> | 141 template<typename T> |
| 129 void visit(const HashSet<Member<T> >& hashSet) | 142 void visit(const HashSet<Member<T> >& hashSet) |
| 130 { | 143 { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 public: | 295 public: |
| 283 virtual void accept(Visitor*) = 0; | 296 virtual void accept(Visitor*) = 0; |
| 284 virtual ~HeapVisitable() | 297 virtual ~HeapVisitable() |
| 285 { | 298 { |
| 286 } | 299 } |
| 287 }; | 300 }; |
| 288 | 301 |
| 289 } | 302 } |
| 290 | 303 |
| 291 #endif | 304 #endif |
| OLD | NEW |