Bug 1418851 - Inlined constant-time definition of nsDisplayItem::Count() - r=mattwoodrow
authorGerald Squelart <gsquelart@mozilla.com>
Tue, 21 Nov 2017 09:14:32 +1100
changeset 392802 67aa5b9539e8416d8335bd1b7800e9029c23d46c
parent 392801 6c027fdb55ddd50f91f95f83484634c6049f44e1
child 392803 76ff493e279fc1cb4706117971bbfddb0a0712b1
push id97527
push usertoros@mozilla.com
push dateTue, 21 Nov 2017 10:20:05 +0000
treeherdermozilla-inbound@60d0f3ee0c43 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1418851, 1404181
milestone59.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 1418851 - Inlined constant-time definition of nsDisplayItem::Count() - r=mattwoodrow The "linear time" comment was rendered incorrect by bug 1404181. And as the body is now only returning a member variable, it's more efficient and maintainable to just have it to the header. MozReview-Commit-ID: 4vjB1PyemxR
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -2628,20 +2628,16 @@ already_AddRefed<LayerManager> nsDisplay
       view->GetViewManager()->InvalidateView(view);
     }
   }
 
   layerManager->SetUserData(&gLayerManagerLayerBuilder, oldBuilder);
   return layerManager.forget();
 }
 
-uint32_t nsDisplayList::Count() const {
-  return mLength;
-}
-
 nsDisplayItem* nsDisplayList::RemoveBottom() {
   nsDisplayItem* item = mSentinel.mAbove;
   if (!item)
     return nullptr;
   mSentinel.mAbove = item->mAbove;
   if (item == mTop) {
     // must have been the only item
     mTop = &mSentinel;
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -2822,20 +2822,19 @@ public:
   }
   /**
    * @return the item at the bottom of the list, or null if the list is empty
    */
   nsDisplayItem* GetBottom() const { return mSentinel.mAbove; }
   bool IsEmpty() const { return mTop == &mSentinel; }
 
   /**
-   * This is *linear time*!
    * @return the number of items in the list
    */
-  uint32_t Count() const;
+  uint32_t Count() const { return mLength; }
   /**
    * Stable sort the list by the z-order of GetUnderlyingFrame() on
    * each item. 'auto' is counted as zero.
    * It is assumed that the list is already in content document order.
    */
   void SortByZOrder();
   /**
    * Stable sort the list by the tree order of the content of