| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 252 |
| 253 // WeakMember version of the templated trace method. It doesn't keep | 253 // WeakMember version of the templated trace method. It doesn't keep |
| 254 // the traced thing alive, but will write null to the WeakMember later | 254 // the traced thing alive, but will write null to the WeakMember later |
| 255 // if the pointed-to object is dead. It's lying for this to be const, | 255 // if the pointed-to object is dead. It's lying for this to be const, |
| 256 // but the overloading resolver prioritizes constness too high when | 256 // but the overloading resolver prioritizes constness too high when |
| 257 // picking the correct overload, so all these trace methods have to have | 257 // picking the correct overload, so all these trace methods have to have |
| 258 // the same constness on their argument to allow the type to decide. | 258 // the same constness on their argument to allow the type to decide. |
| 259 template<typename T> | 259 template<typename T> |
| 260 void trace(const WeakMember<T>& t) | 260 void trace(const WeakMember<T>& t) |
| 261 { | 261 { |
| 262 // Check that we actually know the definition of T when tracing. |
| 263 COMPILE_ASSERT(sizeof(T), WeNeedToKnowTheDefinitionOfTheTypeWeAreTracing
); |
| 262 registerWeakCell(const_cast<WeakMember<T>&>(t).cell()); | 264 registerWeakCell(const_cast<WeakMember<T>&>(t).cell()); |
| 263 } | 265 } |
| 264 | 266 |
| 265 template<typename T> | 267 template<typename T> |
| 266 void traceInCollection(T& t, ShouldWeakPointersBeMarkedStrongly strongify) | 268 void traceInCollection(T& t, ShouldWeakPointersBeMarkedStrongly strongify) |
| 267 { | 269 { |
| 268 HashTraits<T>::traceInCollection(this, t, strongify); | 270 HashTraits<T>::traceInCollection(this, t, strongify); |
| 269 } | 271 } |
| 270 | 272 |
| 271 // Fallback trace method for part objects to allow individual trace methods | 273 // Fallback trace method for part objects to allow individual trace methods |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 struct GCInfoTrait { | 749 struct GCInfoTrait { |
| 748 static const GCInfo* get() | 750 static const GCInfo* get() |
| 749 { | 751 { |
| 750 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); | 752 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); |
| 751 } | 753 } |
| 752 }; | 754 }; |
| 753 | 755 |
| 754 } | 756 } |
| 755 | 757 |
| 756 #endif | 758 #endif |
| OLD | NEW |