On Sun, Jul 12, 2015 at 10:36 PM, Nicholas Nethercote <n.netherc...@gmail.com> wrote: > > Last week I landed patches that remove PL_DHashTableEnumerate() from > the tree (https://bugzilla.mozilla.org/show_bug.cgi?id=1180072). You > should now use PLDHashTable::Iterator if you want to iterate over a > PLDHashTable. The iterator is *so* much nicer -- there's none of that > "bundle up an environment as a |void*| pointer and pass it in with a > function pointer" annoyance. > > I have also added Iterator classes to each of nsTHashtable and > nsBaseHashtable (https://bugzilla.mozilla.org/show_bug.cgi?id=1181445) > and I would like to also eventually remove the enumerate functions > from these classes. However, there are 500+ calls to those enumerate > functions so it's going to take a while. > > For now, I've filed bugs to get rid of all the > nsTHashtable::EnumerateEntries() calls, which account for ~160 of > those 500+. They're all blocking > https://bugzilla.mozilla.org/show_bug.cgi?id=1181443. If you find > yourself in the mood for some not-too-taxing refactoring, please feel > free to take on one or more of the unassigned bugs. The number of > calls to replace in each bug ranges from one or two up to 21. If you > have any questions please ask. Thank you.
With help from several people -- thank you to birtles, ehsan, heycam, mccr8, poiru, TYLin -- nsTHashTable::EnumerateEntries() is *almost* at the point where it can be removed. The 15 calls in netwerk/ (covered by https://bugzilla.mozilla.org/show_bug.cgi?id=1182961) are the only remaining obstacle. Given that, I went ahead and filed bugs to get rid of the ~200 nsBaseHashtable::EnumerateRead() calls and ~140 nsBaseHashtable::Enumerate() calls. They are all marked as blocking https://bugzilla.mozilla.org/show_bug.cgi?id=1181444, and they come in a range of sizes. Some work has been started on these -- thank you to gerald and khuey -- but, again, there's plenty more to be done and assistance would be welcome. If you do want to help, please note that nsBaseHashtable has a subtle distinction between |UserDataType| and |DataType|. As a result: - you should use nsBaseHashtable::Iterator::UserData() if you are replacing an EnumerateRead() call, and - you should use nsBaseHashtable::Iterator::Data() if you are replacing an Enumerate() call. I mentioned this in all the bugs I filed to minimize the likelihood of mix-ups. I also filed all the EnumerateRead()-replacement bugs separately from all the Enumerate()-replacement bugs for the same reason. Please ask me if anything is unclear. Thank you. Nick _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform