Changeset 24059 in webkit for trunk/JavaScriptCore/wtf/HashTraits.h
- Timestamp:
- Jul 6, 2007, 5:09:08 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/HashTraits.h
r19947 r24059 104 104 template<typename P> struct HashTraits<RefPtr<P> > : GenericHashTraits<RefPtr<P> > { 105 105 typedef HashTraits<typename IntTypes<sizeof(P*)>::SignedType> StorageTraits; 106 typedef typename StorageTraits::TraitType StorageType; 106 107 static const bool emptyValueIsZero = true; 107 108 static const bool needsRef = true; 108 static void ref(const RefPtr<P>& p) { if (p) p->ref(); } 109 static void deref(const RefPtr<P>& p) { if (p) p->deref(); } 109 110 typedef union { 111 P* m_p; 112 StorageType m_s; 113 } UnionType; 114 115 static void ref(const StorageType& s) 116 { 117 if (const P* p = reinterpret_cast<const UnionType*>(&s)->m_p) 118 const_cast<P*>(p)->ref(); 119 } 120 static void deref(const StorageType& s) 121 { 122 if (const P* p = reinterpret_cast<const UnionType*>(&s)->m_p) 123 const_cast<P*>(p)->deref(); 124 } 110 125 }; 111 126
Note:
See TracChangeset
for help on using the changeset viewer.