Bug 1339924 - Remove unneeded [queue] lambda capture - r?dholbert draft
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 16 Feb 2017 10:17:32 +1100
changeset 484894 3de2f0dfcff5dd91426ebbe9b8614cd62055e996
parent 484626 ec3ef9f77a52693e9732ca480df16017af0d9504
child 545890 5de7101e9618b4e82a0575c34b4fbe275321f998
push id45591
push usergsquelart@mozilla.com
push dateWed, 15 Feb 2017 23:21:40 +0000
reviewersdholbert
bugs1339924
milestone54.0a1
Bug 1339924 - Remove unneeded [queue] lambda capture - r?dholbert 'queue' is not used inside that lambda, so we can drop it. Another option would have been to simulate its use through `Unused <<`. But I think that it's a useful test, *not* to capture the queue here, to verify that it is correctly captured in the enclosing MozPromise::Then. MozReview-Commit-ID: LUQGPJzDcTb
dom/media/gtest/TestMozPromise.cpp
--- a/dom/media/gtest/TestMozPromise.cpp
+++ b/dom/media/gtest/TestMozPromise.cpp
@@ -190,17 +190,17 @@ TEST(MozPromise, CompletionPromises)
       [queue] (int aVal) -> RefPtr<TestPromise> {
         RefPtr<TestPromise::Private> p = new TestPromise::Private(__func__);
         nsCOMPtr<nsIRunnable> resolver = new DelayedResolveOrReject(queue, p, RRValue::MakeResolve(aVal - 8), 10);
         queue->Dispatch(resolver.forget());
         return RefPtr<TestPromise>(p);
       },
       DO_FAIL)
     ->Then(queue, __func__,
-      [queue] (int aVal) -> RefPtr<TestPromise> { return TestPromise::CreateAndReject(double(aVal - 42) + 42.0, __func__); },
+      [] (int aVal) -> RefPtr<TestPromise> { return TestPromise::CreateAndReject(double(aVal - 42) + 42.0, __func__); },
       DO_FAIL)
     ->Then(queue, __func__,
       DO_FAIL,
       [queue, &invokedPass] (double aVal) -> void { EXPECT_EQ(aVal, 42.0); EXPECT_TRUE(invokedPass); queue->BeginShutdown(); });
   });
 }
 
 TEST(MozPromise, PromiseAllResolve)