Bug 1417312 - Adjust visibility of some CacheMap.h members. - r=daoshengmu a=Sylvstre
authorJeff Gilbert <jgilbert@mozilla.com>
Wed, 15 Nov 2017 18:44:38 -0800
changeset 444975 a06b50c23f1cc1bb85dde0d6c0126944aa2a919f
parent 444974 b1d67871321b4f1e91d90e65a3c9e6292ecca238
child 444976 b4e14a0a551d8b0a86ddca53af74c3a67e8721f1
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaoshengmu, Sylvstre
bugs1417312
milestone58.0
Bug 1417312 - Adjust visibility of some CacheMap.h members. - r=daoshengmu a=Sylvstre MozReview-Commit-ID: fTsP6xbrMU
dom/canvas/CacheMap.h
--- a/dom/canvas/CacheMap.h
+++ b/dom/canvas/CacheMap.h
@@ -10,62 +10,65 @@
 #include "mozilla/UniquePtr.h"
 #include <map>
 #include <unordered_set>
 #include <vector>
 
 namespace mozilla {
 
 namespace detail {
-struct CacheMapUntypedEntry;
+class CacheMapUntypedEntry;
 }
 
 class CacheMapInvalidator
 {
-    friend struct detail::CacheMapUntypedEntry;
+    friend class detail::CacheMapUntypedEntry;
 
     mutable std::unordered_set<const detail::CacheMapUntypedEntry*> mCacheEntries;
 
 public:
     ~CacheMapInvalidator() {
         InvalidateCaches();
     }
 
     void InvalidateCaches() const;
 };
 
 namespace detail {
 
-struct CacheMapUntypedEntry
+class CacheMapUntypedEntry
 {
     template<typename, typename> friend class CacheMap;
 
+private:
     const std::vector<const CacheMapInvalidator*> mInvalidators;
 
+protected:
     CacheMapUntypedEntry(std::vector<const CacheMapInvalidator*>&& invalidators);
     ~CacheMapUntypedEntry();
 
 public:
     virtual void Invalidate() const = 0;
 };
 
-template<typename T>
 struct DerefLess final {
+    template<typename T>
     bool operator ()(const T* const a, const T* const b) const {
         return *a < *b;
     }
 };
 
 } // namespace detail
 
 
 template<typename KeyT, typename ValueT>
 class CacheMap final
 {
-    struct Entry final : public detail::CacheMapUntypedEntry {
+    class Entry final : public detail::CacheMapUntypedEntry {
+    public:
         CacheMap& mParent;
         const KeyT mKey;
         const ValueT mValue;
 
         Entry(std::vector<const CacheMapInvalidator*>&& invalidators, CacheMap& parent,
               KeyT&& key, ValueT&& value)
             : detail::CacheMapUntypedEntry(Move(invalidators))
             , mParent(parent)
@@ -78,17 +81,17 @@ class CacheMap final
             MOZ_ALWAYS_TRUE( erased == 1 );
         }
 
         bool operator <(const Entry& x) const {
             return mKey < x.mKey;
         }
     };
 
-    typedef std::map<const KeyT*, UniquePtr<const Entry>, detail::DerefLess<KeyT>> MapT;
+    typedef std::map<const KeyT*, UniquePtr<const Entry>, detail::DerefLess> MapT;
     MapT mMap;
 
 public:
     const ValueT* Insert(KeyT&& key, ValueT&& value,
                          std::vector<const CacheMapInvalidator*>&& invalidators)
     {
         UniquePtr<const Entry> entry( new Entry(Move(invalidators), *this, Move(key),
                                                 Move(value)) );