Title: [151920] trunk/Source
Revision
151920
Author
mikhail.pozdnya...@intel.com
Date
2013-06-24 12:08:32 -0700 (Mon, 24 Jun 2013)

Log Message

HashMap: reverse the order of the template arguments at alternate 'find', 'contains' and 'add' methods
https://bugs.webkit.org/show_bug.cgi?id=117911

Reviewed by Anders Carlsson.

The order of the template arguments at HashMap alternate 'find', 'contains' and
'add' methods is reversed so that callers can just pass the translator
and let the compiler deduce input argument type.

Another rational is consistency with HashSet class.

Source/WebCore:

* platform/network/HTTPHeaderMap.cpp:
(WebCore::HTTPHeaderMap::get):
(WebCore::HTTPHeaderMap::contains):
(WebCore::HTTPHeaderMap::add):

Source/WTF:

* wtf/HashMap.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (151919 => 151920)


--- trunk/Source/WTF/ChangeLog	2013-06-24 18:47:27 UTC (rev 151919)
+++ trunk/Source/WTF/ChangeLog	2013-06-24 19:08:32 UTC (rev 151920)
@@ -1,3 +1,18 @@
+2013-06-24  Mikhail Pozdnyakov  <mikhail.pozdnya...@intel.com>
+
+        HashMap: reverse the order of the template arguments at alternate 'find', 'contains' and 'add' methods
+        https://bugs.webkit.org/show_bug.cgi?id=117911
+
+        Reviewed by Anders Carlsson.
+
+        The order of the template arguments at HashMap alternate 'find', 'contains' and
+        'add' methods is reversed so that callers can just pass the translator
+        and let the compiler deduce input argument type.
+
+        Another rational is consistency with HashSet class.
+
+        * wtf/HashMap.h:
+
 2013-06-24  pe...@outlook.com  <pe...@outlook.com>
 
         [WinCairo] WTF.dll is linking with CoreFoundation.lib in VS2010.

Modified: trunk/Source/WTF/wtf/HashMap.h (151919 => 151920)


--- trunk/Source/WTF/wtf/HashMap.h	2013-06-24 18:47:27 UTC (rev 151919)
+++ trunk/Source/WTF/wtf/HashMap.h	2013-06-24 19:08:32 UTC (rev 151920)
@@ -117,9 +117,9 @@
         // must have the following function members:
         //   static unsigned hash(const T&);
         //   static bool equal(const ValueType&, const T&);
-        template<typename T, typename HashTranslator> iterator find(const T&);
-        template<typename T, typename HashTranslator> const_iterator find(const T&) const;
-        template<typename T, typename HashTranslator> bool contains(const T&) const;
+        template<typename HashTranslator, typename T> iterator find(const T&);
+        template<typename HashTranslator, typename T> const_iterator find(const T&) const;
+        template<typename HashTranslator, typename T> bool contains(const T&) const;
 
         // An alternate version of add() that finds the object by hashing and comparing
         // with some other type, to avoid the cost of type conversion if the object is already
@@ -127,7 +127,7 @@
         //   static unsigned hash(const T&);
         //   static bool equal(const ValueType&, const T&);
         //   static translate(ValueType&, const T&, unsigned hashCode);
-        template<typename T, typename HashTranslator> AddResult add(const T&, MappedPassInType);
+        template<typename HashTranslator, typename T> AddResult add(const T&, MappedPassInType);
 
         void checkConsistency() const;
 
@@ -312,7 +312,7 @@
     }
 
     template<typename T, typename U, typename V, typename W, typename X>
-    template<typename TYPE, typename HashTranslator>
+    template<typename HashTranslator, typename TYPE>
     inline typename HashMap<T, U, V, W, X>::iterator
     HashMap<T, U, V, W, X>::find(const TYPE& value)
     {
@@ -320,7 +320,7 @@
     }
 
     template<typename T, typename U, typename V, typename W, typename X>
-    template<typename TYPE, typename HashTranslator>
+    template<typename HashTranslator, typename TYPE>
     inline typename HashMap<T, U, V, W, X>::const_iterator 
     HashMap<T, U, V, W, X>::find(const TYPE& value) const
     {
@@ -328,7 +328,7 @@
     }
 
     template<typename T, typename U, typename V, typename W, typename X>
-    template<typename TYPE, typename HashTranslator>
+    template<typename HashTranslator, typename TYPE>
     inline bool
     HashMap<T, U, V, W, X>::contains(const TYPE& value) const
     {
@@ -355,7 +355,7 @@
     }
 
     template<typename T, typename U, typename V, typename W, typename X>
-    template<typename TYPE, typename HashTranslator>
+    template<typename HashTranslator, typename TYPE>
     typename HashMap<T, U, V, W, X>::AddResult
     HashMap<T, U, V, W, X>::add(const TYPE& key, MappedPassInType value)
     {

Modified: trunk/Source/WebCore/ChangeLog (151919 => 151920)


--- trunk/Source/WebCore/ChangeLog	2013-06-24 18:47:27 UTC (rev 151919)
+++ trunk/Source/WebCore/ChangeLog	2013-06-24 19:08:32 UTC (rev 151920)
@@ -1,3 +1,21 @@
+2013-06-24  Mikhail Pozdnyakov  <mikhail.pozdnya...@intel.com>
+
+        HashMap: reverse the order of the template arguments at alternate 'find', 'contains' and 'add' methods
+        https://bugs.webkit.org/show_bug.cgi?id=117911
+
+        Reviewed by Anders Carlsson.
+
+        The order of the template arguments at HashMap alternate 'find', 'contains' and
+        'add' methods is reversed so that callers can just pass the translator
+        and let the compiler deduce input argument type.
+
+        Another rational is consistency with HashSet class.
+
+        * platform/network/HTTPHeaderMap.cpp:
+        (WebCore::HTTPHeaderMap::get):
+        (WebCore::HTTPHeaderMap::contains):
+        (WebCore::HTTPHeaderMap::add):
+
 2013-06-24  Robert Hogan  <rob...@webkit.org>
 
         Remove unnecessary check in RenderBlockLineLayout::nextSegmentBreak()

Modified: trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp (151919 => 151920)


--- trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp	2013-06-24 18:47:27 UTC (rev 151919)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp	2013-06-24 19:08:32 UTC (rev 151920)
@@ -97,7 +97,7 @@
 
 String HTTPHeaderMap::get(const char* name) const
 {
-    const_iterator i = find<const char*, CaseFoldingCStringTranslator>(name);
+    const_iterator i = find<CaseFoldingCStringTranslator>(name);
     if (i == end())
         return String();
     return i->value;
@@ -105,12 +105,12 @@
     
 bool HTTPHeaderMap::contains(const char* name) const
 {
-    return find<const char*, CaseFoldingCStringTranslator>(name) != end();
+    return find<CaseFoldingCStringTranslator>(name) != end();
 }
 
 HTTPHeaderMap::AddResult HTTPHeaderMap::add(const char* name, const String& value)
 {
-    return HashMap<AtomicString, String, CaseFoldingHash>::add<const char*, CaseFoldingCStringTranslator>(name, value);
+    return HashMap<AtomicString, String, CaseFoldingHash>::add<CaseFoldingCStringTranslator>(name, value);
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to