Bug 1312960 - Use CancelableRunnable for mOnChannelConnectedTask (r=dvander)
authorBill McCloskey <billm@mozilla.com>
Sat, 15 Oct 2016 11:54:56 -0700
changeset 320252 f1d9568cc12ff3160954a6a9038d1163dbd31a93
parent 320251 b30dfbf5fe2a45cee43810a90eed05a595303a33
child 320253 13826b3d90c7a9db7f2f00b5c93636a9d2be3867
push id83336
push userwmccloskey@mozilla.com
push dateMon, 31 Oct 2016 05:04:12 +0000
treeherdermozilla-inbound@774891f4556d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs1312960
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1312960 - Use CancelableRunnable for mOnChannelConnectedTask (r=dvander)
ipc/glue/MessageChannel.cpp
ipc/glue/MessageChannel.h
--- a/ipc/glue/MessageChannel.cpp
+++ b/ipc/glue/MessageChannel.cpp
@@ -507,18 +507,18 @@ MessageChannel::MessageChannel(MessageLi
     mTopFrame = nullptr;
     mIsSyncWaitingOnNonMainThread = false;
 #endif
 
     RefPtr<CancelableRunnable> runnable =
         NewNonOwningCancelableRunnableMethod(this, &MessageChannel::OnMaybeDequeueOne);
     mDequeueOneTask = new RefCountedTask(runnable.forget());
 
-    runnable = NewNonOwningCancelableRunnableMethod(this, &MessageChannel::DispatchOnChannelConnected);
-    mOnChannelConnectedTask = new RefCountedTask(runnable.forget());
+    mOnChannelConnectedTask =
+        NewNonOwningCancelableRunnableMethod(this, &MessageChannel::DispatchOnChannelConnected);
 
 #ifdef OS_WIN
     mEvent = CreateEventW(nullptr, TRUE, FALSE, nullptr);
     MOZ_RELEASE_ASSERT(mEvent, "CreateEvent failed! Nothing is going to work!");
 #endif
 }
 
 MessageChannel::~MessageChannel()
@@ -1938,17 +1938,17 @@ MessageChannel::SetReplyTimeoutMs(int32_
 }
 
 void
 MessageChannel::OnChannelConnected(int32_t peer_id)
 {
     MOZ_RELEASE_ASSERT(!mPeerPidSet);
     mPeerPidSet = true;
     mPeerPid = peer_id;
-    RefPtr<DequeueTask> task = new DequeueTask(mOnChannelConnectedTask);
+    RefPtr<CancelableRunnable> task = mOnChannelConnectedTask;
     mWorkerLoop->PostTask(task.forget());
 }
 
 void
 MessageChannel::DispatchOnChannelConnected()
 {
     AssertWorkerThread();
     MOZ_RELEASE_ASSERT(mPeerPidSet);
--- a/ipc/glue/MessageChannel.h
+++ b/ipc/glue/MessageChannel.h
@@ -783,17 +783,17 @@ class MessageChannel : HasResultCodes
     bool mNotifiedChannelDone;
 
     // See SetChannelFlags
     ChannelFlags mFlags;
 
     // Task and state used to asynchronously notify channel has been connected
     // safely.  This is necessary to be able to cancel notification if we are
     // closed at the same time.
-    RefPtr<RefCountedTask> mOnChannelConnectedTask;
+    RefPtr<CancelableRunnable> mOnChannelConnectedTask;
     bool mPeerPidSet;
     int32_t mPeerPid;
 };
 
 void
 CancelCPOWs();
 
 } // namespace ipc