Bug 1318228 - NewRunnable defaults to StoreCopyPassByConstLRef - r?froydnj draft
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 17 Nov 2016 17:07:02 +1100
changeset 441513 d35adc6f6984fef1cac5490d58cb1cf0ce089e89
parent 441455 f09e137ead39230eaa94f47988ccce2cfcda4195
child 441514 c4a4d245ca232d83b2ff0c414c081b85871624c2
push id36432
push usergsquelart@mozilla.com
push dateFri, 18 Nov 2016 23:21:02 +0000
reviewersfroydnj
bugs1318228
milestone53.0a1
Bug 1318228 - NewRunnable defaults to StoreCopyPassByConstLRef - r?froydnj MozReview-Commit-ID: LmQHthMLUd3
xpcom/glue/nsThreadUtils.h
xpcom/glue/tests/gtest/TestThreadUtils.cpp
--- a/xpcom/glue/nsThreadUtils.h
+++ b/xpcom/glue/nsThreadUtils.h
@@ -692,17 +692,17 @@ struct LValueReferenceStorageClass
                          StoreRefPassByLRef<TWithoutRef>>
 {};
 
 template<typename T>
 struct SmartPointerStorageClass
   : mozilla::Conditional<IsRefcountedSmartPointer<T>::value,
                          StorensRefPtrPassByPtr<
                            typename StripSmartPointer<T>::Type>,
-                         StoreCopyPassByValue<T>>
+                         StoreCopyPassByConstLRef<T>>
 {};
 
 template<typename T>
 struct NonLValueReferenceStorageClass
   : mozilla::Conditional<mozilla::IsRvalueReference<T>::value,
                          StoreCopyPassByRRef<
                            typename mozilla::RemoveReference<T>::Type>,
                          typename SmartPointerStorageClass<T>::Type>
@@ -732,19 +732,19 @@ struct NonParameterStorageClass
 //   ^^ RC quacks like a ref-counted type (i.e., has AddRef and Release methods)
 // - const T*  -> StoreConstPtrPassByConstPtr<T> : Store const T*, pass const T*
 // - T*        -> StorePtrPassByPtr<T>           : Store T*, pass T*.
 // - const T&  -> StoreConstRefPassByConstLRef<T>: Store const T&, pass const T&.
 // - T&        -> StoreRefPassByLRef<T>          : Store T&, pass T&.
 // - T&&       -> StoreCopyPassByRRef<T>         : Store T, pass Move(T).
 // - RefPtr<T>, nsCOMPtr<T>
 //             -> StorensRefPtrPassByPtr<T>      : Store RefPtr<T>, pass T*
-// - Other T   -> StoreCopyPassByValue<T>        : Store T, pass T.
+// - Other T   -> StoreCopyPassByConstLRef<T>    : Store T, pass const T&.
 // Other available explicit options:
-// -              StoreCopyPassByConstLRef<T>    : Store T, pass const T&.
+// -              StoreCopyPassByValue<T>        : Store T, pass T.
 // -              StoreCopyPassByLRef<T>         : Store T, pass T& (of copy!)
 // -              StoreCopyPassByConstPtr<T>     : Store T, pass const T*
 // -              StoreCopyPassByPtr<T>          : Store T, pass T* (of copy!)
 // Or create your own class with PassAsParameter() method, optional
 // clean-up in destructor, and with associated IsParameterStorageClass<>.
 template<typename T>
 struct ParameterStorage
   : mozilla::Conditional<IsParameterStorageClass<T>::value,
--- a/xpcom/glue/tests/gtest/TestThreadUtils.cpp
+++ b/xpcom/glue/tests/gtest/TestThreadUtils.cpp
@@ -302,18 +302,18 @@ TEST(ThreadUtils, main)
   // Test variadic function with simple POD arguments.
 
   r1 = NewRunnableMethod(rpt, &ThreadUtilsObject::Test0);
   r1->Run();
   EXPECT_EQ(count += 1, rpt->mCount);
 
   static_assert(
       mozilla::IsSame< ::detail::ParameterStorage<int>::Type,
-                      StoreCopyPassByValue<int>>::value,
-      "detail::ParameterStorage<int>::Type should be StoreCopyPassByValue<int>");
+                      StoreCopyPassByConstLRef<int>>::value,
+      "detail::ParameterStorage<int>::Type should be StoreCopyPassByConstLRef<int>");
   static_assert(
       mozilla::IsSame< ::detail::ParameterStorage<StoreCopyPassByValue<int>>::Type,
                       StoreCopyPassByValue<int>>::value,
       "detail::ParameterStorage<StoreCopyPassByValue<int>>::Type should be StoreCopyPassByValue<int>");
 
   r1 = NewRunnableMethod<int>(rpt, &ThreadUtilsObject::Test1i, 12);
   r1->Run();
   EXPECT_EQ(count += 2, rpt->mCount);