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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 447 |
448 String m_tracingName; | 448 String m_tracingName; |
449 #else | 449 #else |
450 inline void recordBacktrace() const { } | 450 inline void recordBacktrace() const { } |
451 #endif | 451 #endif |
452 // m_raw is accessed most, so put it at the first field. | 452 // m_raw is accessed most, so put it at the first field. |
453 T* m_raw; | 453 T* m_raw; |
454 PersistentNode* m_persistentNode; | 454 PersistentNode* m_persistentNode; |
455 }; | 455 }; |
456 | 456 |
| 457 // A class T having a public CROSS_THREAD_ACCESSIBLE() declaration makes |
| 458 // WebPrivatePtr<T> refer to objects of type T using a CrossThreadPersistent<T>. |
| 459 // This to allow WebPrivatePtr<T> objects to be destructed on another thread. |
| 460 #define CROSS_THREAD_ACCESSIBLE() typedef int IsCrossThreadAccessibleMarker |
| 461 |
457 // PersistentNode must be the left-most class to let the | 462 // PersistentNode must be the left-most class to let the |
458 // visitor->trace(static_cast<Collection*>(this)) trace the correct position. | 463 // visitor->trace(static_cast<Collection*>(this)) trace the correct position. |
459 // FIXME: derive affinity based on the collection. | 464 // FIXME: derive affinity based on the collection. |
460 template<typename Collection> | 465 template<typename Collection> |
461 class PersistentHeapCollectionBase : public Collection { | 466 class PersistentHeapCollectionBase : public Collection { |
462 // We overload the various new and delete operators with using the WTF Defau
ltAllocator to ensure persistent | 467 // We overload the various new and delete operators with using the WTF Defau
ltAllocator to ensure persistent |
463 // heap collections are always allocated off-heap. This allows persistent co
llections to be used in | 468 // heap collections are always allocated off-heap. This allows persistent co
llections to be used in |
464 // DEFINE_STATIC_LOCAL et. al. | 469 // DEFINE_STATIC_LOCAL et. al. |
465 WTF_USE_ALLOCATOR(PersistentHeapCollectionBase, WTF::DefaultAllocator); | 470 WTF_USE_ALLOCATOR(PersistentHeapCollectionBase, WTF::DefaultAllocator); |
466 public: | 471 public: |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { | 1205 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { |
1201 static_assert(sizeof(T), "T must be fully defined"); | 1206 static_assert(sizeof(T), "T must be fully defined"); |
1202 }; | 1207 }; |
1203 | 1208 |
1204 template<typename T> | 1209 template<typename T> |
1205 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 1210 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; |
1206 | 1211 |
1207 } // namespace WTF | 1212 } // namespace WTF |
1208 | 1213 |
1209 #endif | 1214 #endif |
OLD | NEW |