Bug 1417312 - Adjust visibility of some CacheMap.h members. - r=daoshengmu
authorJeff Gilbert <jgilbert@mozilla.com>
Wed, 15 Nov 2017 18:44:38 -0800
changeset 392388 8a49cb129f99e31bc5a4d3e05520d553fa9adcc3
parent 392387 e9767488caca8cc0fb44525d6a8f3d86e362b756
child 392389 2fec62780f475cfb6633cac9b7393c0cc99cbb74
push id97465
push userjgilbert@mozilla.com
push dateFri, 17 Nov 2017 21:06:38 +0000
treeherdermozilla-inbound@8a49cb129f99 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaoshengmu
bugs1417312
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 1417312 - Adjust visibility of some CacheMap.h members. - r=daoshengmu 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)) );