Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 782 if (reinterpret_cast<intptr_t>(m_raw) % allocationGranularity) | 782 if (reinterpret_cast<intptr_t>(m_raw) % allocationGranularity) | 
| 783 return; | 783 return; | 
| 784 | 784 | 
| 785 // TODO(haraken): What we really want to check here is that the pointer | 785 // TODO(haraken): What we really want to check here is that the pointer | 
| 786 // is a traceable object. In other words, the pointer is either of: | 786 // is a traceable object. In other words, the pointer is either of: | 
| 787 // | 787 // | 
| 788 // (a) a pointer to the head of an on-heap object. | 788 // (a) a pointer to the head of an on-heap object. | 
| 789 // (b) a pointer to the head of an on-heap mixin object. | 789 // (b) a pointer to the head of an on-heap mixin object. | 
| 790 // | 790 // | 
| 791 // We can check it by calling Heap::isHeapObjectAlive(m_raw), | 791 // We can check it by calling Heap::isHeapObjectAlive(m_raw), | 
| 792 // but we cannot call it here because it requres to include T.h. | 792 // but we cannot call it here because it requires to include T.h. | 
| 793 // So we currently implement only the check for (a). | 793 // So we currently only try to implement the check for (a), but do | 
| 794 if (!IsGarbageCollectedMixin<T>::value) | 794 // not insist that T's definition is in scope. | 
| 795 if (IsFullyDefined<T>::value && !IsGarbageCollectedMixin<T>::value) | |
| 
 
Nico
2015/06/30 20:04:45
If this assert fires now depends on .h include ord
 
sof
2015/06/30 20:10:59
That's entirely to be expected. e.g., TrackBase do
 
 | |
| 795 ASSERT(HeapObjectHeader::fromPayload(m_raw)->checkHeader()); | 796 ASSERT(HeapObjectHeader::fromPayload(m_raw)->checkHeader()); | 
| 796 #endif | 797 #endif | 
| 797 } | 798 } | 
| 798 | 799 | 
| 799 T* m_raw; | 800 T* m_raw; | 
| 800 | 801 | 
| 801 template<bool x, WTF::WeakHandlingFlag y, WTF::ShouldWeakPointersBeMarkedStr ongly z, typename U, typename V> friend struct CollectionBackingTraceTrait; | 802 template<bool x, WTF::WeakHandlingFlag y, WTF::ShouldWeakPointersBeMarkedStr ongly z, typename U, typename V> friend struct CollectionBackingTraceTrait; | 
| 802 friend class Visitor; | 803 friend class Visitor; | 
| 803 | 804 | 
| 804 }; | 805 }; | 
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1287 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin k::IsGarbageCollectedType<T>::value> { | 1288 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin k::IsGarbageCollectedType<T>::value> { | 
| 1288 static_assert(sizeof(T), "T must be fully defined"); | 1289 static_assert(sizeof(T), "T must be fully defined"); | 
| 1289 }; | 1290 }; | 
| 1290 | 1291 | 
| 1291 template<typename T> | 1292 template<typename T> | 
| 1292 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 1293 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 
| 1293 | 1294 | 
| 1294 } // namespace WTF | 1295 } // namespace WTF | 
| 1295 | 1296 | 
| 1296 #endif | 1297 #endif | 
| OLD | NEW |