From 985851ccca3613902b655b45cdd6c4280e607d30 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Tue, 5 Jul 2016 18:49:06 -0400 Subject: [PATCH] Bug 1283616 - part 1 - micro-optimize removing microtask runnables from the queue; r=khuey We can just extract the reference we want from the queue since we're about to remove it; no sense in performing extra refcounting if we don't need to. --- dom/promise/Promise.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dom/promise/Promise.cpp b/dom/promise/Promise.cpp index 2cd9cbdb36dc..80de7560cf18 100644 --- a/dom/promise/Promise.cpp +++ b/dom/promise/Promise.cpp @@ -995,7 +995,7 @@ Promise::PerformMicroTaskCheckpoint() AutoSafeJSContext cx; do { - nsCOMPtr runnable = microtaskQueue.front(); + nsCOMPtr runnable = microtaskQueue.front().forget(); MOZ_ASSERT(runnable); // This function can re-enter, so we remove the element before calling. @@ -1032,7 +1032,7 @@ Promise::PerformWorkerMicroTaskCheckpoint() } } - nsCOMPtr runnable = microtaskQueue->front(); + nsCOMPtr runnable = microtaskQueue->front().forget(); MOZ_ASSERT(runnable); // This function can re-enter, so we remove the element before calling. @@ -1062,7 +1062,7 @@ Promise::PerformWorkerDebuggerMicroTaskCheckpoint() break; } - nsCOMPtr runnable = microtaskQueue->front(); + nsCOMPtr runnable = microtaskQueue->front().forget(); MOZ_ASSERT(runnable); // This function can re-enter, so we remove the element before calling.