Bug 1544583 - Change RDL list index to uint32_t r=mattwoodrow
authorMiko Mynttinen <mikokm@gmail.com>
Mon, 15 Apr 2019 23:16:30 +0000
changeset 469588 bacdb7ee8f0e
parent 469587 9feaaddc3761
child 469589 3c62bdc7e166
push id35874
push userccoroiu@mozilla.com
push dateTue, 16 Apr 2019 04:04:58 +0000
treeherdermozilla-central@be3f40425b52 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1544583
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1544583 - Change RDL list index to uint32_t r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D27623
layout/painting/RetainedDisplayListHelpers.h
--- a/layout/painting/RetainedDisplayListHelpers.h
+++ b/layout/painting/RetainedDisplayListHelpers.h
@@ -53,23 +53,26 @@ bool SpanContains(mozilla::Span<const T>
 }
 
 class OldListUnits {};
 class MergedListUnits {};
 
 template <typename Units>
 struct Index {
   Index() : val(0) {}
-  explicit Index(size_t aVal) : val(aVal) {}
+  explicit Index(size_t aVal) : val(aVal) {
+    MOZ_RELEASE_ASSERT(aVal < std::numeric_limits<uint32_t>::max(),
+                       "List index overflowed");
+  }
 
   bool operator==(const Index<Units>& aOther) const {
     return val == aOther.val;
   }
 
-  size_t val;
+  uint32_t val;
 };
 typedef Index<OldListUnits> OldListIndex;
 typedef Index<MergedListUnits> MergedListIndex;
 
 template <typename T>
 class DirectedAcyclicGraph {
  public:
   DirectedAcyclicGraph() = default;
@@ -158,15 +161,15 @@ struct OldItemInfo {
   bool IsDiscarded() {
     MOZ_ASSERT(IsUsed());
     return mDiscarded;
   }
 
   bool IsChanged();
 
   nsDisplayItem* mItem;
+  nsTArray<MergedListIndex> mDirectPredecessors;
+  MergedListIndex mIndex;
   bool mUsed;
   bool mDiscarded;
-  MergedListIndex mIndex;
-  nsTArray<MergedListIndex> mDirectPredecessors;
 };
 
 #endif  // RETAINEDDISPLAYLISTHELPERS_H_