commit 6d7307c0cd1e0d7d3904f9a0e7f5103a5187db1e
parent 63248187d7f090cf4ca85d46102de559362135c4
Author: serge-sans-paille <sguelton@mozilla.com>
Date: Thu, 9 Oct 2025 09:41:37 +0000
Bug 1993156 - Cleanup mfbt/DoublyLinkedList.h and mfbt/LinkedList.h r=emilio
Remove some unused includes, reorder includes and replace an explicit
loop by the equivalent stl algorithm.
Differential Revision: https://phabricator.services.mozilla.com/D267906
Diffstat:
4 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp
@@ -65,7 +65,6 @@
#include "mozilla/FloatingPoint.h"
#include "mozilla/FlushType.h"
#include "mozilla/Likely.h"
-#include "mozilla/LinkedList.h"
#include "mozilla/Logging.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/Maybe.h"
diff --git a/dom/base/nsGlobalWindowOuter.h b/dom/base/nsGlobalWindowOuter.h
@@ -27,7 +27,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/FlushType.h"
-#include "mozilla/LinkedList.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/BrowsingContext.h"
diff --git a/mfbt/DoublyLinkedList.h b/mfbt/DoublyLinkedList.h
@@ -524,8 +524,8 @@ class SafeDoublyLinkedList {
bool isEmpty() const { return mList.isEmpty(); }
bool contains(T* aElm) {
- for (auto iter = mList.begin(); iter != mList.end(); ++iter) {
- if (&*iter == aElm) {
+ for (const T& el : *this) {
+ if (aElm == &el) {
return true;
}
}
diff --git a/mfbt/LinkedList.h b/mfbt/LinkedList.h
@@ -65,8 +65,8 @@
#define mozilla_LinkedList_h
#include <algorithm>
-#include <utility>
#include <iterator>
+#include <utility>
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"