Bug 1387002 - Replace .size() by .empty() when applicable in xpcom/ r?froydnj draft
authorSylvestre Ledru <sledru@mozilla.com>
Thu, 03 Aug 2017 12:08:32 +0200
changeset 621067 3a5d577eb6357bd0f0729166d549d4d6baf7f061
parent 621066 2515560fa636553c1237729fe8957905888c9ffc
child 640884 1107fab2cadd2d99e3ab13b6bc323bd7bae0cd8e
push id72240
push userbmo:sledru@mozilla.com
push dateFri, 04 Aug 2017 08:12:30 +0000
reviewersfroydnj
bugs1387002
milestone57.0a1
Bug 1387002 - Replace .size() by .empty() when applicable in xpcom/ r?froydnj MozReview-Commit-ID: LWzpVGVV7Py
xpcom/threads/TaskQueue.cpp
--- a/xpcom/threads/TaskQueue.cpp
+++ b/xpcom/threads/TaskQueue.cpp
@@ -220,17 +220,17 @@ TaskQueue::WrapAsEventTarget()
 
 nsresult
 TaskQueue::Runner::Run()
 {
   RefPtr<nsIRunnable> event;
   {
     MonitorAutoLock mon(mQueue->mQueueMonitor);
     MOZ_ASSERT(mQueue->mIsRunning);
-    if (mQueue->mTasks.size() == 0) {
+    if (mQueue->mTasks.empty()) {
       mQueue->mIsRunning = false;
       mQueue->MaybeResolveShutdown();
       mon.NotifyAll();
       return NS_OK;
     }
     event = mQueue->mTasks.front().forget();
     mQueue->mTasks.pop();
   }
@@ -250,17 +250,17 @@ TaskQueue::Runner::Run()
   // object it's calling, and we don't want to keep it alive, it may be
   // making assumptions what holds references to it. This is especially
   // the case if the object is waiting for us to shutdown, so that it
   // can shutdown (like in the MediaDecoderStateMachine's SHUTDOWN case).
   event = nullptr;
 
   {
     MonitorAutoLock mon(mQueue->mQueueMonitor);
-    if (mQueue->mTasks.size() == 0) {
+    if (mQueue->mTasks.empty()) {
       // No more events to run. Exit the task runner.
       mQueue->mIsRunning = false;
       mQueue->MaybeResolveShutdown();
       mon.NotifyAll();
       return NS_OK;
     }
   }