diff --git a/xpcom/glue/nsThreadUtils.h b/xpcom/glue/nsThreadUtils.h index 3441f566d9b4..a4997c9c9ce3 100644 --- a/xpcom/glue/nsThreadUtils.h +++ b/xpcom/glue/nsThreadUtils.h @@ -539,6 +539,36 @@ template struct HasRefCountMethods : decltype(HasRefCountMethodsTest(0)) {}; +template +struct IsRefcountedSmartPointer : public mozilla::FalseType +{}; + +template +struct IsRefcountedSmartPointer> : public mozilla::TrueType +{}; + +template +struct IsRefcountedSmartPointer> : public mozilla::TrueType +{}; + +template +struct StripSmartPointer +{ + typedef void Type; +}; + +template +struct StripSmartPointer> +{ + typedef T Type; +}; + +template +struct StripSmartPointer> +{ + typedef T Type; +}; + template struct PointerStorageClass : mozilla::Conditional::value, @@ -556,12 +586,20 @@ struct LValueReferenceStorageClass StoreRefPassByLRef> {}; +template +struct SmartPointerStorageClass + : mozilla::Conditional::value, + StorensRefPtrPassByPtr< + typename StripSmartPointer::Type>, + StoreCopyPassByValue> +{}; + template struct NonLValueReferenceStorageClass : mozilla::Conditional::value, StoreCopyPassByRRef< typename mozilla::RemoveReference::Type>, - StoreCopyPassByValue> + typename SmartPointerStorageClass::Type> {}; template @@ -591,6 +629,8 @@ struct NonParameterStorageClass // - const T& -> StoreConstRefPassByConstLRef: Store const T&, pass const T&. // - T& -> StoreRefPassByLRef : Store T&, pass T&. // - T&& -> StoreCopyPassByRRef : Store T, pass Move(T). +// - nsRefPtr, nsCOMPtr +// -> StorensRefPtrPassByPtr : Store nsRefPtr, pass T* // - Other T -> StoreCopyPassByValue : Store T, pass T. // Other available explicit options: // - StoreCopyPassByConstLRef : Store T, pass const T&.