| 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 28 matching lines...) Expand all Loading... |
| 39 #include "wtf/HashFunctions.h" | 39 #include "wtf/HashFunctions.h" |
| 40 #include "wtf/Locker.h" | 40 #include "wtf/Locker.h" |
| 41 #include "wtf/RawPtr.h" | 41 #include "wtf/RawPtr.h" |
| 42 #include "wtf/RefCounted.h" | 42 #include "wtf/RefCounted.h" |
| 43 #include "wtf/TypeTraits.h" | 43 #include "wtf/TypeTraits.h" |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 template<typename T> class HeapTerminatedArray; | 47 template<typename T> class HeapTerminatedArray; |
| 48 | 48 |
| 49 // Template to determine if a class is a GarbageCollectedMixin by checking if it | |
| 50 // has IsGarbageCollectedMixinMarker | |
| 51 template<typename T> | |
| 52 struct IsGarbageCollectedMixin { | |
| 53 private: | |
| 54 typedef char YesType; | |
| 55 struct NoType { | |
| 56 char padding[8]; | |
| 57 }; | |
| 58 | |
| 59 template <typename U> static YesType checkMarker(typename U::IsGarbageCollec
tedMixinMarker*); | |
| 60 template <typename U> static NoType checkMarker(...); | |
| 61 | |
| 62 public: | |
| 63 static const bool value = sizeof(checkMarker<T>(nullptr)) == sizeof(YesType)
; | |
| 64 }; | |
| 65 | |
| 66 template <typename T> | 49 template <typename T> |
| 67 struct IsGarbageCollectedType { | 50 struct IsGarbageCollectedType { |
| 68 using TrueType = char; | 51 using TrueType = char; |
| 69 struct FalseType { | 52 struct FalseType { |
| 70 char dummy[2]; | 53 char dummy[2]; |
| 71 }; | 54 }; |
| 72 | 55 |
| 73 using NonConstType = typename WTF::RemoveConst<T>::Type; | 56 using NonConstType = typename WTF::RemoveConst<T>::Type; |
| 74 using GarbageCollectedSubclass = WTF::IsSubclassOfTemplate<NonConstType, Gar
bageCollected>; | 57 using GarbageCollectedSubclass = WTF::IsSubclassOfTemplate<NonConstType, Gar
bageCollected>; |
| 75 using GarbageCollectedMixinSubclass = IsGarbageCollectedMixin<NonConstType>; | 58 using GarbageCollectedMixinSubclass = IsGarbageCollectedMixin<NonConstType>; |
| (...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 template<typename T> | 1160 template<typename T> |
| 1178 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { | 1161 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { |
| 1179 }; | 1162 }; |
| 1180 | 1163 |
| 1181 template<typename T> | 1164 template<typename T> |
| 1182 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 1165 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; |
| 1183 | 1166 |
| 1184 } // namespace WTF | 1167 } // namespace WTF |
| 1185 | 1168 |
| 1186 #endif | 1169 #endif |
| OLD | NEW |