| 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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 } | 941 } |
| 942 | 942 |
| 943 SelfKeepAlive& operator=(Self* self) | 943 SelfKeepAlive& operator=(Self* self) |
| 944 { | 944 { |
| 945 assign(self); | 945 assign(self); |
| 946 return *this; | 946 return *this; |
| 947 } | 947 } |
| 948 | 948 |
| 949 void clear() | 949 void clear() |
| 950 { | 950 { |
| 951 #if ENABLE(ASSERT) | |
| 952 if (m_keepAlive) | |
| 953 ThreadState::decrementSelfKeepAliveAllocations(); | |
| 954 #endif | |
| 955 m_keepAlive.clear(); | 951 m_keepAlive.clear(); |
| 956 } | 952 } |
| 957 | 953 |
| 958 typedef OwnPtr<Persistent<Self>> (SelfKeepAlive::*UnspecifiedBoolType); | 954 typedef OwnPtr<Persistent<Self>> (SelfKeepAlive::*UnspecifiedBoolType); |
| 959 operator UnspecifiedBoolType() const { return m_keepAlive ? &SelfKeepAlive::
m_keepAlive : 0; } | 955 operator UnspecifiedBoolType() const { return m_keepAlive ? &SelfKeepAlive::
m_keepAlive : 0; } |
| 960 | 956 |
| 961 private: | 957 private: |
| 962 void assign(Self* self) | 958 void assign(Self* self) |
| 963 { | 959 { |
| 964 ASSERT(!m_keepAlive || m_keepAlive->get() == self); | 960 ASSERT(!m_keepAlive || m_keepAlive->get() == self); |
| 965 if (!m_keepAlive) { | 961 if (!m_keepAlive) |
| 966 m_keepAlive = adoptPtr(new Persistent<Self>); | 962 m_keepAlive = adoptPtr(new Persistent<Self>); |
| 967 #if ENABLE(ASSERT) | |
| 968 ThreadState::incrementSelfKeepAliveAllocations(); | |
| 969 #endif | |
| 970 } | |
| 971 *m_keepAlive = self; | 963 *m_keepAlive = self; |
| 972 } | 964 } |
| 973 | 965 |
| 974 GC_PLUGIN_IGNORE("420515") | 966 GC_PLUGIN_IGNORE("420515") |
| 975 OwnPtr<Persistent<Self>> m_keepAlive; | 967 OwnPtr<Persistent<Self>> m_keepAlive; |
| 976 }; | 968 }; |
| 977 | 969 |
| 978 } // namespace blink | 970 } // namespace blink |
| 979 | 971 |
| 980 namespace WTF { | 972 namespace WTF { |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { | 1156 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { |
| 1165 static_assert(sizeof(T), "T must be fully defined"); | 1157 static_assert(sizeof(T), "T must be fully defined"); |
| 1166 }; | 1158 }; |
| 1167 | 1159 |
| 1168 template<typename T> | 1160 template<typename T> |
| 1169 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 1161 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; |
| 1170 | 1162 |
| 1171 } // namespace WTF | 1163 } // namespace WTF |
| 1172 | 1164 |
| 1173 #endif | 1165 #endif |
| OLD | NEW |