From 4ab55413a3f7c3cd8e9b1c1a860d88bbcbcf34ce Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Thu, 11 Jun 2020 07:17:25 +0000 Subject: [PATCH] Bug 1644640 - Rename RemoveElementsAt(const_iterator, const_iterator) to RemoveElementsRange. r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D79033 --- dom/indexedDB/ActorsParent.cpp | 2 +- toolkit/components/commandlines/nsCommandLine.cpp | 2 +- toolkit/components/url-classifier/HashStore.cpp | 2 +- xpcom/ds/nsTArray.h | 3 ++- xpcom/tests/gtest/TestTArray.cpp | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index c5b3a43527d1..4000e8147136 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -12630,7 +12630,7 @@ void ConnectionPool::ScheduleQueuedTransactions(ThreadInfo aThreadInfo) { /* aFromQueuedTransactions */ true); }); - mQueuedTransactions.RemoveElementsAt(mQueuedTransactions.begin(), foundIt); + mQueuedTransactions.RemoveElementsRange(mQueuedTransactions.begin(), foundIt); AdjustIdleTimer(); } diff --git a/toolkit/components/commandlines/nsCommandLine.cpp b/toolkit/components/commandlines/nsCommandLine.cpp index 733f807c4d31..09e4d6e7c1fe 100644 --- a/toolkit/components/commandlines/nsCommandLine.cpp +++ b/toolkit/components/commandlines/nsCommandLine.cpp @@ -96,7 +96,7 @@ nsCommandLine::RemoveArguments(int32_t aStart, int32_t aEnd) { NS_ENSURE_ARG_MIN(aStart, 0); NS_ENSURE_ARG_MAX(uint32_t(aEnd) + 1, mArgs.Length()); - mArgs.RemoveElementsAt(mArgs.begin() + aStart, mArgs.begin() + aEnd + 1); + mArgs.RemoveElementsRange(mArgs.begin() + aStart, mArgs.begin() + aEnd + 1); return NS_OK; } diff --git a/toolkit/components/url-classifier/HashStore.cpp b/toolkit/components/url-classifier/HashStore.cpp index bafaa7f3d140..3229b0bebb98 100644 --- a/toolkit/components/url-classifier/HashStore.cpp +++ b/toolkit/components/url-classifier/HashStore.cpp @@ -985,7 +985,7 @@ template static void Erase(FallibleTArray* array, typename FallibleTArray::iterator& iterStart, typename FallibleTArray::iterator& iterEnd) { - array->RemoveElementsAt(iterStart, iterEnd); + array->RemoveElementsRange(iterStart, iterEnd); } // Find items matching between |subs| and |adds|, and remove them, diff --git a/xpcom/ds/nsTArray.h b/xpcom/ds/nsTArray.h index 2e34934bfddd..9429387b7ad9 100644 --- a/xpcom/ds/nsTArray.h +++ b/xpcom/ds/nsTArray.h @@ -1762,7 +1762,8 @@ class nsTArray_Impl // std::vector::erase. // @param first iterator to the first of elements to remove // @param last iterator to the last of elements to remove - const_iterator RemoveElementsAt(const_iterator first, const_iterator last) { + const_iterator RemoveElementsRange(const_iterator first, + const_iterator last) { MOZ_ASSERT(first.GetArray() == this); MOZ_ASSERT(last.GetArray() == this); MOZ_ASSERT(last.GetIndex() >= first.GetIndex()); diff --git a/xpcom/tests/gtest/TestTArray.cpp b/xpcom/tests/gtest/TestTArray.cpp index 8421e6b5eea3..8b93eee21dc3 100644 --- a/xpcom/tests/gtest/TestTArray.cpp +++ b/xpcom/tests/gtest/TestTArray.cpp @@ -800,11 +800,11 @@ TEST(TArray, RemoveElementAt_ByIterator) ASSERT_EQ(expected, array); } -TEST(TArray, RemoveElementsAt_ByIterator) +TEST(TArray, RemoveElementsRange_ByIterator) { nsTArray array{1, 2, 3, 4}; const auto it = std::find(array.begin(), array.end(), 3); - const auto itAfter = array.RemoveElementsAt(it, array.end()); + const auto itAfter = array.RemoveElementsRange(it, array.end()); // Based on the implementation of the iterator, we could compare it and // itAfter, but we should not rely on such implementation details.