Bug 1365517 - Remove the call to AbstractThread::GetCurrent() in TestAsyncReturns.cpp. draft
authorJW Wang <jwwang@mozilla.com>
Wed, 17 May 2017 15:34:20 +0800
changeset 580112 48d2781568930da057bf6a10a3af6c54ad2c539b
parent 580111 df997298207aab401501d1b5ef2f5bbcf2749309
child 629184 d4796bbc7f11382ad6b18647f26ab4dc531c57e0
push id59445
push userjwwang@mozilla.com
push dateThu, 18 May 2017 05:56:29 +0000
bugs1365517, 1365483
milestone55.0a1
Bug 1365517 - Remove the call to AbstractThread::GetCurrent() in TestAsyncReturns.cpp. See bug 1365483 for the rationale. MozReview-Commit-ID: AGFtjTzRqvC
ipc/ipdl/test/cxx/TestAsyncReturns.cpp
--- a/ipc/ipdl/test/cxx/TestAsyncReturns.cpp
+++ b/ipc/ipdl/test/cxx/TestAsyncReturns.cpp
@@ -21,32 +21,32 @@ TestAsyncReturnsParent::TestAsyncReturns
 TestAsyncReturnsParent::~TestAsyncReturnsParent()
 {
   MOZ_COUNT_DTOR(TestAsyncReturnsParent);
 }
 
 void
 TestAsyncReturnsParent::Main()
 {
-  if (!AbstractThread::GetCurrent()) {
+  if (!AbstractThread::MainThread()) {
     fail("AbstractThread not initalized");
   }
-  SendNoReturn()->Then(AbstractThread::GetCurrent(), __func__,
+  SendNoReturn()->Then(AbstractThread::MainThread(), __func__,
                        [](bool unused) {
                          fail("resolve handler should not be called");
                        },
                        [](PromiseRejectReason aReason) {
                          // MozPromise asserts in debug build if the
                          // handler is not called
                          if (aReason != PromiseRejectReason::ChannelClosed) {
                            fail("reject with wrong reason");
                          }
                          passed("reject handler called on channel close");
                        });
-  SendPing()->Then(AbstractThread::GetCurrent(), __func__,
+  SendPing()->Then(AbstractThread::MainThread(), __func__,
                    [this](bool one) {
                      if (one) {
                        passed("take one argument");
                      } else {
                        fail("get one argument but has wrong value");
                      }
                      Close();
                    },
@@ -83,20 +83,20 @@ TestAsyncReturnsChild::RecvNoReturn(RefP
   // Leak the promise intentionally
   Unused << do_AddRef(aPromise);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 TestAsyncReturnsChild::RecvPing(RefPtr<PingPromise>&& aPromise)
 {
-  if (!AbstractThread::GetCurrent()) {
+  if (!AbstractThread::MainThread()) {
     fail("AbstractThread not initalized");
   }
-  SendPong()->Then(AbstractThread::GetCurrent(), __func__,
+  SendPong()->Then(AbstractThread::MainThread(), __func__,
                    [aPromise](const Tuple<uint32_t, uint32_t>& aParam) {
                      if (Get<0>(aParam) == sMagic1 && Get<1>(aParam) == sMagic2) {
                        passed("take two arguments");
                      } else {
                        fail("get two argument but has wrong value");
                      }
                      aPromise->Resolve(true, __func__);
                    },