gecko-dev/uriloader/base
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
nsCURILoader.idl
nsDocLoader.cpp Bug 1174625 - Overhaul PLDHashTable's iterator. r=froydnj. 2015-06-11 21:19:53 -07:00
nsDocLoader.h Bug 1171830 - Remove PL_DHashTableEnumerator use from nsDocLoader. r=smaug. 2015-06-10 13:07:40 -07:00
nsIContentHandler.idl
nsIDocumentLoader.idl
nsITransfer.idl Backed out changesets fb903f13f215, 9c5c712698e4, and 36d257ead3da (bug 1092835) for causing test_csp_allow_https_schemes.html permafail on Android 2.3. 2014-12-09 14:00:47 -05:00
nsIURIContentListener.idl Bug 1136388. Change nsIDocumentLoaderFactory and nsIURIContentListener to take MIME types as an XPCOM string, not a char*. r=smaug 2015-02-25 10:26:51 -05:00
nsIURILoader.idl Bug 906276 - Add attribute to nsIDocShell to disable content retargeting. r=jlebar, sr=biesinger 2013-08-24 01:10:50 -07:00
nsIWebProgress.idl Bug 691610 - e10s support for useDefaultIcon. r=felipe sr=smaug 2013-07-29 11:03:41 -04:00
nsIWebProgressListener2.idl Backed out changesets fb903f13f215, 9c5c712698e4, and 36d257ead3da (bug 1092835) for causing test_csp_allow_https_schemes.html permafail on Android 2.3. 2014-12-09 14:00:47 -05:00
nsIWebProgressListener.idl Bug 1092835 - Log usage of weak ciphers in the console. r=keeler,mcmanus 2014-12-13 20:09:01 +09:00
nsURILoader.cpp Bug 1165515 - Part 13-2: Replace usage of PRLogModuleLevel and PR_LOG_*. rs=froydnj 2015-06-03 15:25:57 -07:00
nsURILoader.h Bug 1165518 - Part 2: Replace prlog.h with Logging.h. rs=froydnj 2015-05-19 11:15:34 -07:00