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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 inline void recordBacktrace() const { } | 262 inline void recordBacktrace() const { } |
263 #endif | 263 #endif |
264 // m_raw is accessed most, so put it at the first field. | 264 // m_raw is accessed most, so put it at the first field. |
265 T* m_raw; | 265 T* m_raw; |
266 PersistentNode* m_persistentNode; | 266 PersistentNode* m_persistentNode; |
267 #if ENABLE(ASSERT) | 267 #if ENABLE(ASSERT) |
268 ThreadState* m_state; | 268 ThreadState* m_state; |
269 #endif | 269 #endif |
270 }; | 270 }; |
271 | 271 |
272 // Persistent is a way to create a strong pointer from an on-heap object | 272 // Persistent is a way to create a strong pointer from an off-heap object |
273 // to another on-heap object. As long as the Persistent handle is alive | 273 // to another on-heap object. As long as the Persistent handle is alive |
274 // the GC will keep the object pointed to alive. The Persistent handle is | 274 // the GC will keep the object pointed to alive. The Persistent handle is |
275 // always a GC root from the point of view of the GC. | 275 // always a GC root from the point of view of the GC. |
276 // | 276 // |
277 // We have to construct and destruct Persistent in the same thread. | 277 // We have to construct and destruct Persistent in the same thread. |
278 template<typename T> | 278 template<typename T> |
279 class Persistent : public PersistentBase<T, NonWeakPersistentConfiguration, Sing
leThreadPersistentConfiguration> { | 279 class Persistent : public PersistentBase<T, NonWeakPersistentConfiguration, Sing
leThreadPersistentConfiguration> { |
280 typedef PersistentBase<T, NonWeakPersistentConfiguration, SingleThreadPersis
tentConfiguration> Parent; | 280 typedef PersistentBase<T, NonWeakPersistentConfiguration, SingleThreadPersis
tentConfiguration> Parent; |
281 public: | 281 public: |
282 Persistent() : Parent() { } | 282 Persistent() : Parent() { } |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { | 1179 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { |
1180 static_assert(sizeof(T), "T must be fully defined"); | 1180 static_assert(sizeof(T), "T must be fully defined"); |
1181 }; | 1181 }; |
1182 | 1182 |
1183 template<typename T> | 1183 template<typename T> |
1184 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 1184 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; |
1185 | 1185 |
1186 } // namespace WTF | 1186 } // namespace WTF |
1187 | 1187 |
1188 #endif | 1188 #endif |
OLD | NEW |