Bug 1452601 - Drop LayersId::EqualFn as it is unnecessary. r?botond draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 09 Apr 2018 08:29:55 -0400
changeset 779192 2904808b702bb0c395ff2e7a44c38e3dbdd11cd5
parent 779146 30d72755b1749953d438199456f1524ce84ab5e5
push id105687
push userkgupta@mozilla.com
push dateMon, 09 Apr 2018 12:30:27 +0000
reviewersbotond
bugs1452601
milestone61.0a1
Bug 1452601 - Drop LayersId::EqualFn as it is unnecessary. r?botond It's not needed, because by default std::unorderd_map will use std::equal_to which delegates to the operator== on LayersId which does the same thing. We don't need to reimplement it. MozReview-Commit-ID: CLJO2JJfbF4
gfx/layers/LayersTypes.h
gfx/layers/apz/src/APZCTreeManager.h
gfx/layers/apz/src/FocusState.h
--- a/gfx/layers/LayersTypes.h
+++ b/gfx/layers/LayersTypes.h
@@ -72,31 +72,25 @@ struct LayersId {
     return mId == aOther.mId;
   }
 
   bool operator!=(const LayersId& aOther) const
   {
     return !(*this == aOther);
   }
 
-  // Helper operators that allow this class to be used as a key in
+  // Helper struct that allow this class to be used as a key in
   // std::unordered_map like so:
-  //   std::unordered_map<LayersId, ValueType, LayersId::HashFn, LayersId::EqualFn> myMap;
+  //   std::unordered_map<LayersId, ValueType, LayersId::HashFn> myMap;
   struct HashFn {
     std::size_t operator()(const LayersId& aKey) const
     {
       return std::hash<uint64_t>{}(aKey.mId);
     }
   };
-  struct EqualFn {
-    bool operator()(const LayersId& lhs, const LayersId& rhs) const
-    {
-      return lhs.mId == rhs.mId;
-    }
-  };
 };
 
 enum class LayersBackend : int8_t {
   LAYERS_NONE = 0,
   LAYERS_BASIC,
   LAYERS_OPENGL,
   LAYERS_D3D11,
   LAYERS_CLIENT,
--- a/gfx/layers/apz/src/APZCTreeManager.h
+++ b/gfx/layers/apz/src/APZCTreeManager.h
@@ -774,18 +774,17 @@ private:
   class CheckerboardFlushObserver;
   friend class CheckerboardFlushObserver;
   RefPtr<CheckerboardFlushObserver> mFlushObserver;
 
   // Map from layers id to APZTestData. Accesses and mutations must be
   // protected by the mTestDataLock.
   std::unordered_map<LayersId,
                      UniquePtr<APZTestData>,
-                     LayersId::HashFn,
-                     LayersId::EqualFn> mTestData;
+                     LayersId::HashFn> mTestData;
   mutable mozilla::Mutex mTestDataLock;
 
   // This must only be touched on the controller thread.
   float mDPI;
 
 #if defined(MOZ_WIDGET_ANDROID)
 public:
   AndroidDynamicToolbarAnimator* GetAndroidDynamicToolbarAnimator();
--- a/gfx/layers/apz/src/FocusState.h
+++ b/gfx/layers/apz/src/FocusState.h
@@ -139,18 +139,17 @@ private:
 private:
   // All methods should hold this lock, since this class is accessed via both
   // the updater and controller threads.
   mutable Mutex mMutex;
 
   // The set of focus targets received indexed by their layer tree ID
   std::unordered_map<LayersId,
                      FocusTarget,
-                     LayersId::HashFn,
-                     LayersId::EqualFn> mFocusTree;
+                     LayersId::HashFn> mFocusTree;
 
   // The focus sequence number of the last potentially focus changing event
   // processed by APZ. This number starts at one and increases monotonically.
   // We don't worry about wrap around here because at a pace of 100 increments/sec,
   // it would take 5.85*10^9 years before we would wrap around. This number will
   // never be zero as that is used to catch uninitialized focus sequence numbers
   // on input events.
   uint64_t mLastAPZProcessedEvent;