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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // takes a const argument, because otherwise it will match too eagerly: a | 180 // takes a const argument, because otherwise it will match too eagerly: a |
181 // non-const argument would match a non-const Vector<T>& argument better | 181 // non-const argument would match a non-const Vector<T>& argument better |
182 // than the specialization that takes const Vector<T>&. For a similar reason
, | 182 // than the specialization that takes const Vector<T>&. For a similar reason
, |
183 // the other specializations take a const argument even though they are | 183 // the other specializations take a const argument even though they are |
184 // usually used with non-const arguments, otherwise this function would matc
h | 184 // usually used with non-const arguments, otherwise this function would matc
h |
185 // too well. | 185 // too well. |
186 template<typename T> | 186 template<typename T> |
187 void trace(const T& t) | 187 void trace(const T& t) |
188 { | 188 { |
189 static_assert(sizeof(T), "T must be fully defined"); | 189 static_assert(sizeof(T), "T must be fully defined"); |
190 if (WTF::IsPolymorphic<T>::value) { | 190 if (std::is_polymorphic<T>::value) { |
191 intptr_t vtable = *reinterpret_cast<const intptr_t*>(&t); | 191 intptr_t vtable = *reinterpret_cast<const intptr_t*>(&t); |
192 if (!vtable) | 192 if (!vtable) |
193 return; | 193 return; |
194 } | 194 } |
195 TraceTrait<T>::trace(Derived::fromHelper(this), &const_cast<T&>(t)); | 195 TraceTrait<T>::trace(Derived::fromHelper(this), &const_cast<T&>(t)); |
196 } | 196 } |
197 | 197 |
198 #if !ENABLE(OILPAN) | 198 #if !ENABLE(OILPAN) |
199 // These trace methods are needed to allow compiling and calling trace on | 199 // These trace methods are needed to allow compiling and calling trace on |
200 // transition types. We need to support calls in the non-oilpan build | 200 // transition types. We need to support calls in the non-oilpan build |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 static const String get() | 389 static const String get() |
390 { | 390 { |
391 return WTF::extractTypeNameFromFunctionName(WTF::extractNameFunction<T>(
)); | 391 return WTF::extractTypeNameFromFunctionName(WTF::extractNameFunction<T>(
)); |
392 } | 392 } |
393 }; | 393 }; |
394 #endif | 394 #endif |
395 | 395 |
396 } // namespace blink | 396 } // namespace blink |
397 | 397 |
398 #endif // Visitor_h | 398 #endif // Visitor_h |
OLD | NEW |