From 257e69aae5710c191e633554edd9b6206336bd29 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Sat, 17 May 2014 23:10:53 +0000 Subject: [PATCH] Bug 1009263 - Add nsCheapSets::Clear() method that removes all entries and return it to minimal size in terms of memory use. r=bsmedberg --- xpcom/ds/nsCheapSets.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xpcom/ds/nsCheapSets.h b/xpcom/ds/nsCheapSets.h index ccd577d886d3..0fabbebd380f 100644 --- a/xpcom/ds/nsCheapSets.h +++ b/xpcom/ds/nsCheapSets.h @@ -24,6 +24,14 @@ public: { } ~nsCheapSet() + { + Clear(); + } + + /** + * Remove all entries. + */ + void Clear() { switch (mState) { case ZERO: @@ -38,6 +46,7 @@ public: NS_NOTREACHED("bogus state"); break; } + mState = ZERO; } nsresult Put(const KeyType aVal);