gecko-dev/netwerk/cache
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
..
moz.build Bug 1157835: Remove the MSVC_ENABLE_PGO flag from the build system. r=glandium 2015-04-27 19:59:27 -04:00
nsApplicationCache.h Bug 1028588 - Fix dangerous public destructors in netwerk/ - r=mcmanus 2014-06-24 12:36:44 -04:00
nsApplicationCacheService.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
nsApplicationCacheService.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
nsCache.cpp Bug 1165515 - Part 13-2: Replace usage of PRLogModuleLevel and PR_LOG_*. rs=froydnj 2015-06-03 15:25:57 -07:00
nsCache.h Bug 1165515 - Part 13-2: Replace usage of PRLogModuleLevel and PR_LOG_*. rs=froydnj 2015-06-03 15:25:57 -07:00
nsCacheDevice.h
nsCacheEntry.cpp Bug 1170534 - Remove Visual Event Tracer. r=dougt 2015-06-02 11:44:00 -04:00
nsCacheEntry.h Bug 1170416 (part 3) - Remove the PLDHashTable2 typedef. r=froydnj. 2015-05-19 16:46:17 -07:00
nsCacheEntryDescriptor.cpp Bug 1134920 - Use moz_xmalloc/moz_xrealloc/free instead of nsMemory::Alloc/Realloc/Free. r=nfroyd 2015-04-01 13:51:45 +09:00
nsCacheEntryDescriptor.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
nsCacheMetaData.cpp Bug 1138293 - Use malloc/free/realloc/calloc instead of moz_malloc/moz_free/moz_realloc/moz_calloc. r=njn 2015-03-31 12:32:49 +09:00
nsCacheMetaData.h Bug 1138293 - Use malloc/free/realloc/calloc instead of moz_malloc/moz_free/moz_realloc/moz_calloc. r=njn 2015-03-31 12:32:49 +09:00
nsCacheRequest.h
nsCacheService.cpp Bug 1165515 - Part 13-2: Replace usage of PRLogModuleLevel and PR_LOG_*. rs=froydnj 2015-06-03 15:25:57 -07:00
nsCacheService.h Bug 1162336 - Part 1: Remove instances of #ifdef PR_LOGGING in netwerk. r=froydnj 2015-05-07 12:52:44 -07:00
nsCacheSession.cpp Bug 900908 - Part 3: Change uses of numbered macros in nsIClassInfoImpl.h/nsISupportsImpl.h to the variadic variants. r=froydnj 2014-04-27 03:06:00 -04:00
nsCacheSession.h Bug 1028588 - Fix dangerous public destructors in netwerk/ - r=mcmanus 2014-06-24 12:36:44 -04:00
nsCacheUtils.cpp Bug 1048271 - Fix more bad implicit constructors in netwerk; r=mcmanus 2014-08-05 09:20:24 -04:00
nsCacheUtils.h Bug 1048271 - Fix more bad implicit constructors in netwerk; r=mcmanus 2014-08-05 09:20:24 -04:00
nsDeleteDir.cpp Bug 1014394 - Correctly delete all HTTP cache leftover trashes, r=michal 2014-05-29 00:52:21 +02:00
nsDeleteDir.h
nsDiskCache.h Bug 354493 - revert Add nsINetworkZonePolicy to protect resources loaded from private IPs r=backout a=backout 2014-07-24 10:05:36 -04:00
nsDiskCacheBinding.cpp Bug 1174625 - Overhaul PLDHashTable's iterator. r=froydnj. 2015-06-11 21:19:53 -07:00
nsDiskCacheBinding.h Bug 1170416 (part 3) - Remove the PLDHashTable2 typedef. r=froydnj. 2015-05-19 16:46:17 -07:00
nsDiskCacheBlockFile.cpp
nsDiskCacheBlockFile.h
nsDiskCacheDevice.cpp Bug 1165515 - Part 13-2: Replace usage of PRLogModuleLevel and PR_LOG_*. rs=froydnj 2015-06-03 15:25:57 -07:00
nsDiskCacheDevice.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
nsDiskCacheDeviceSQL.cpp Bug 1165515 - Part 13-2: Replace usage of PRLogModuleLevel and PR_LOG_*. rs=froydnj 2015-06-03 15:25:57 -07:00
nsDiskCacheDeviceSQL.h Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
nsDiskCacheEntry.cpp Bug 900908 - Part 3: Change uses of numbered macros in nsIClassInfoImpl.h/nsISupportsImpl.h to the variadic variants. r=froydnj 2014-04-27 03:06:00 -04:00
nsDiskCacheEntry.h Bug 1028588 - Fix dangerous public destructors in netwerk/ - r=mcmanus 2014-06-24 12:36:44 -04:00
nsDiskCacheMap.cpp Bug 1170534 - Remove Visual Event Tracer. r=dougt 2015-06-02 11:44:00 -04:00
nsDiskCacheMap.h
nsDiskCacheStreams.cpp Bug 1170534 - Remove Visual Event Tracer. r=dougt 2015-06-02 11:44:00 -04:00
nsDiskCacheStreams.h Bug 1156632 - Remove unused forward class declarations - patch 4 - netwerk image and dom, r=ehsan 2015-04-22 08:29:20 +02:00
nsICache.idl
nsICacheEntryDescriptor.idl
nsICacheListener.idl
nsICacheService.idl Bug 999577 - disable addon access to cache v1 IDLs, r=michal+jduell 2014-06-05 20:14:07 +02:00
nsICacheSession.idl
nsICacheVisitor.idl
nsMemoryCacheDevice.cpp Bug 1168007 (part 9) - Use PLDHashTable2 in nsCacheEntry. r=froydnj. 2015-05-18 21:45:30 -07:00
nsMemoryCacheDevice.h Bug 1048271 - Fix more bad implicit constructors in netwerk; r=mcmanus 2014-08-05 09:20:24 -04:00