Bug 1902344 - Remove outdated data structure references in "Using C++ in Mozilla code" and elsewhere. r=xpcom-reviewers,nika DONTBUILD

nsAutoTArray was renamed to AutoTArray.

nsDataHashtable and nsJSThingHashtable don't exist any more.

nsTHashMap and nsTHashSet now exist.

nsDeque is properly typed now.

Pair is now CompactPair.

Differential Revision: https://phabricator.services.mozilla.com/D213624
This commit is contained in:
Andrew McCreight 2024-06-13 22:41:51 +00:00
parent 55b9b2c815
commit 1911f0174a
5 changed files with 15 additions and 14 deletions

View File

@ -381,7 +381,7 @@ Data structures
- Header
- STL equivalent
- Notes
* - ``nsAutoTArray``
* - ``AutoTArray``
- ``nsTArray.h``
-
- Like ``nsTArray``, but will store a small amount as stack storage
@ -401,13 +401,17 @@ Data structures
- ``nsCOMArray.h``
-
- Like ``nsTArray<nsCOMPtr<T>>``
* - ``nsDataHashtable``
- ``nsClassHashtable.h``
* - ``nsTHashMap``
- ``nsTHashMap.h``
- ``std::unordered_map``
- Adaptation of ``nsTHashtable``, see :ref:`XPCOM Hashtable Guide`
* - ``nsTHashSet``
- ``nsTHashSet.h``
- ``std::unordered_set``
- Adaptation of ``nsTHashtable``, see :ref:`XPCOM Hashtable Guide`
* - ``nsDeque``
- ``nsDeque.h``
- ``std::deque<void *>``
- ``std::deque<T>``
-
* - ``mozilla::EnumSet``
- ``mozilla/EnumSet.h``
@ -425,7 +429,7 @@ Data structures
- ``mozilla/LinkedList.h``
- ``std::list``
- Doubly-linked list
* - ``nsRef PtrHashtable``
* - ``nsRefPtrHashtable``
- ``nsRefPtrHashtable.h``
- ``std::unordered_map``
- Adaptation of ``nsTHashtable``, see :ref:`XPCOM Hashtable Guide`
@ -616,8 +620,8 @@ Miscellaneous
- mfbt/MaybeOneOf.h
- ``std::optional<std::variant<T1, T2>>``
- ~ ``mozilla::Maybe<union {T1, T2}>``
* - ``mozilla::Pair``
- mfbt/Pair.h
* - ``mozilla::CompactPair``
- mfbt/CompactPair.h
- ``std::tuple<T1, T2>``
- minimal space!
* - ``mozilla::TimeStamp``
@ -679,8 +683,8 @@ Currently, these include:
- `1126552 <https://bugzilla.mozilla.org/show_bug.cgi?id=1126552>`__
- Random-access
- Also reverse-iterable. Also supports remove-erase pattern via RemoveElementsAt method. Also supports back-inserting output iterators via ``MakeBackInserter`` function.
* - ``nsBaseHashtable`` and subclasses: ``nsClassHashtable`` ``nsDataHashtable`` ``nsInterfaceHashtable`` ``nsJSThingHashtable`` ``nsRefPtrHashtable``
- ``xpcom/ds/nsBaseHashtable.h`` ``xpcom/ds/nsClassHashtable.h`` ``xpcom/ds/nsDataHashtable.h`` ``xpcom/ds/nsInterfaceHashtable.h`` ``xpcom/ds/nsJSThingHashtable.h`` ``xpcom/ds/nsRefPtrHashtable.h``
* - ``nsBaseHashtable`` and subclasses: ``nsTHashMap`` ``nsTHashSet`` ``nsClassHashtable`` ``nsInterfaceHashtable`` ``nsRefPtrHashtable``
- ``xpcom/ds/nsBaseHashtable.h`` ``xpcom/ds/nsTHashMap.h`` ``xpcom/ds/nsTHashSet.h`` ``xpcom/ds/nsClassHashtable.h`` ``xpcom/ds/nsInterfaceHashtable.h`` ``xpcom/ds/nsRefPtrHashtable.h``
- `1575479 <https://bugzilla.mozilla.org/show_bug.cgi?id=1575479>`__
- Forward
-

View File

@ -38,7 +38,7 @@
#include "nsLiteralString.h" // for NS_LITERAL_STRING
#include "nsPIDOMWindow.h" // for nsPIDOMWindowInner, etc.
#include "nsString.h" // for nsCString
#include "nsTArray.h" // for nsTArray and nsAutoTArray
#include "nsTArray.h" // for nsTArray and AutoTArray
#include "nsWeakReference.h" // for nsSupportsWeakReference
#include "nscore.h" // for nsresult, nsAString, etc.

View File

@ -47,7 +47,7 @@ bool IPDLParamTraits<mozilla::layers::DisplayListData>::Read(
void WriteScrollUpdates(IPC::MessageWriter* aWriter, IProtocol* aActor,
layers::ScrollUpdatesMap& aParam) {
// ICK: we need to manually serialize this map because
// nsDataHashTable doesn't support it (and other maps cause other issues)
// nsTHashMap doesn't support it (and other maps cause other issues)
WriteIPDLParam(aWriter, aActor, aParam.Count());
for (auto it = aParam.ConstIter(); !it.Done(); it.Next()) {
WriteIPDLParam(aWriter, aActor, it.Key());

View File

@ -331,8 +331,6 @@ opaque-types = [
# is available
"mozilla::detail::PointerType",
"mozilla::HashSet",
"mozilla::Pair",
"mozilla::Pair_Base",
"mozilla::ScrollAxis", # <- For some reason the alignment of this is 4
# for clang.
"mozilla::SeenPtrs",

View File

@ -117,7 +117,6 @@ can put it all together. A few examples:
struct - ``nsTHashMap<JSContext*, UniquePtr<ContextInfo>>``
- A hashset of strings - ``nsTHashSet<nsString>``
.. _nsBaseHashtable_and_friends:_nsDataHashtable.2C_nsInterfaceHashtable.2C_and_nsClassHashtable:
Hashtable API
-------------