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