gecko-dev/xpcom/tests
Nicholas Nethercote a1b715b5df Bug 1174625 - Overhaul PLDHashTable's iterator. r=froydnj.
This change splits PLDHashTable::Iterator::NextEntry() into two separate
functions, which allow you to get the current element and advance the iterator
separately, which means you can use a for-loop to iterate instead of a
while-loop.

As part of this change, the internals of PLDHashTable::Iterator were
significantly changed and simplified (and modelled after js::HashTable's
equivalent code). It's no longer duplicating code from PL_DHashTableEnumerator.
The chaos mode code was a casualty of this, but given how unreliable that code
has proven to be (see bug 1173212, bug 1174046) this is for the best. (We can
reimplement chaos mode once PLDHashTable::Iterator is back on more solid
footing again, if we think it's important.)

All these changes will make it much easier to add an alternative Iterator that
removes elements, which was turning out to be difficult with the prior code.

In order to make the for-loop header usually fit on a single line, I
deliberately renamed a bunch of things to have shorter names.

In summary, you used to write this:

  PLDHashTable::Iterator iter(&table);
  while (iter.HasMoreEntries()) {
    auto entry = static_cast<FooEntry*>(iter.NextEntry());
    // ... do stuff with |entry| ...
  }
  // iter's scope extends beyond here

and now you write this:

  for (auto iter = table.Iter(); !iter.Done(); iter.Next()) {
    auto entry = static_cast<FooEntry*>(iter.Get());
    // ... do stuff with |entry| ...
  }
  // iter's scope doesn't reach here

--HG--
extra : rebase_source : fa5cac2fc50b1ab7624030bced4763131280f4d8
2015-06-11 21:19:53 -07:00
..
bug656331_component Bug 1043692 - Add a DIST_INSTALL variable to moz.build, and replace NO_DIST_INSTALL with it. r=gps 2015-05-12 07:55:21 +09:00
component Bug 1043692 - Add a DIST_INSTALL variable to moz.build, and replace NO_DIST_INSTALL with it. r=gps 2015-05-12 07:55:21 +09:00
component_no_aslr Bug 1043692 - Add a DIST_INSTALL variable to moz.build, and replace NO_DIST_INSTALL with it. r=gps 2015-05-12 07:55:21 +09:00
external Bug 1134923 - Remove NS_Alloc/NS_Realloc/NS_Free. r=nfroyd 2015-05-01 09:40:30 +09:00
gtest Bug 1166504 - Make nsMultiplexInputStream cloneable. r=bkelly,froydnj 2015-06-02 16:12:57 -07:00
regorder
static-checker
unit Bug 1159737 Stop supporting binary XPCOM components except built into the application. r=froydnj sr=bz Some xpcshell tests of binary functionality need to register binary components. Expose a function "registerAppManifest" in the xpcshell environment to make this available to tests without exposing it to addons. r=bholley 2015-05-01 10:23:44 -04:00
windows Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj 2015-03-21 12:28:04 -04:00
Makefile.in Bug 924187 - Deal with interfaces.manifest from the backend. r=mshal 2015-02-13 08:11:57 -05:00
MoreTestingAtomList.h
MoreTestingAtoms.cpp
MoreTestingAtoms.h
moz.build Bug 1140762 - Move TestThreads.cpp to gtest and enable it; r=froydnj 2015-03-09 11:10:32 -04:00
NotXPCOMTest.idl Bug 1069518 - XPTCall should refuse to implement interfaces with [notxpcom] methods, r=froydnj/bholley 2014-09-22 15:10:31 -04:00
nsIFileEnumerator.cpp
RegFactory.cpp
resources.h
ShowAlignments.cpp
SizeTest01.cpp
SizeTest02.cpp
SizeTest03.cpp
SizeTest04.cpp
SizeTest05.cpp
SizeTest06.cpp
test.properties
TestArguments.cpp
TestAtoms.cpp Backed out changeset 186127d71076 (bug 1126295) because of test bustage on Windows on a CLOSED TREE 2015-01-27 13:47:44 -05:00
TestAutoPtr.cpp Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj 2015-03-21 12:28:04 -04:00
TestAutoRef.cpp
TestBase64.cpp Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj 2015-03-21 12:28:04 -04:00
TestBlockingProcess.cpp
TestCallTemplates.cpp Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
TestCOMArray.cpp Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj 2015-03-21 12:28:04 -04:00
TestCOMPtr.cpp
TestCOMPtrEq.cpp
TestDeadlockDetector.cpp
TestDeadlockDetectorScalability.cpp Bug 1097507 - Make libxul independent of libdmd when DMD is enabled. r=njn 2014-11-18 19:21:06 +09:00
TestDeque.cpp
TestFile.cpp
TestHarness.h Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj 2015-03-21 12:28:04 -04:00
TestHashtables.cpp Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj 2015-03-21 12:28:04 -04:00
TestID.cpp
TestingAtomList.h
TestingAtoms.cpp
TestingAtoms.h
TestINIParser.cpp
TestJemalloc.cpp
TestNsRefPtr.cpp Bug 1095098 - move do_QueryObject templates into their own header; r=froydnj 2015-04-15 12:47:03 -04:00
TestObserverArray.cpp
TestObserverService.cpp Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
TestPipe.cpp
TestPLDHash.cpp Bug 1174625 - Overhaul PLDHashTable's iterator. r=froydnj. 2015-06-11 21:19:53 -07:00
TestPRIntN.cpp
TestQuickReturn.cpp
TestRacingServiceManager.cpp Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj 2015-03-21 12:28:04 -04:00
TestRegistrationOrder.cpp Bug 1159737 Stop supporting binary XPCOM components except built into the application. r=froydnj sr=bz Some xpcshell tests of binary functionality need to register binary components. Expose a function "registerAppManifest" in the xpcshell environment to make this available to tests without exposing it to addons. r=bholley 2015-05-01 10:23:44 -04:00
TestShutdown.cpp
TestStackCrawl.cpp
TestStaticAtoms.cpp
TestSTLWrappers.cpp
TestStreamUtils.cpp
TestStringAPI.cpp
TestTArray.cpp Bug 968520 - Add mozilla::fallible to FallibleArray calls in tests. r=froydnj 2015-06-08 13:39:49 -07:00
TestTextFormatter.cpp
TestThreadPoolListener.cpp Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj 2015-03-21 12:28:04 -04:00
TestThreadUtils.cpp Bug 1034921 - Remove dangerous public destructor of nsFoo in TestThreadUtils.cpp. r=nfroyd 2014-09-04 07:07:00 +02:00
TestTimers.cpp Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj 2015-03-21 12:28:04 -04:00
TestUnicodeArguments.cpp
TestWinReg.js