Title: [192920] trunk
Revision
192920
Author
mmaxfi...@apple.com
Date
2015-12-01 15:30:03 -0800 (Tue, 01 Dec 2015)

Log Message

Give String and AtomicString an existingHash() function
https://bugs.webkit.org/show_bug.cgi?id=151717

Reviewed by Andreas Kling.

Source/WebCore:

No new tests because there is no behavior change.

* platform/graphics/Font.cpp:
(WebCore::CharacterFallbackMapKeyHash::hash):

Source/WTF:

Test: WTF.AtomicStringExistingHash
      WTF.StringExistingHash

* wtf/text/AtomicString.h:
(WTF::AtomicString::existingHash):
* wtf/text/WTFString.h:
(WTF::String::existingHash):

Tools:

* TestWebKitAPI/Tests/WTF/AtomicString.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WTF/WTFString.cpp:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (192919 => 192920)


--- trunk/Source/WTF/ChangeLog	2015-12-01 22:47:00 UTC (rev 192919)
+++ trunk/Source/WTF/ChangeLog	2015-12-01 23:30:03 UTC (rev 192920)
@@ -1,3 +1,18 @@
+2015-12-01  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Give String and AtomicString an existingHash() function
+        https://bugs.webkit.org/show_bug.cgi?id=151717
+
+        Reviewed by Andreas Kling.
+
+        Test: WTF.AtomicStringExistingHash
+              WTF.StringExistingHash
+
+        * wtf/text/AtomicString.h:
+        (WTF::AtomicString::existingHash):
+        * wtf/text/WTFString.h:
+        (WTF::String::existingHash):
+
 2015-12-01  Yusuke Suzuki  <utatane....@gmail.com>
 
         [ES6] Implement LLInt/Baseline Support for ES6 Generators and enable this feature

Modified: trunk/Source/WTF/wtf/text/AtomicString.h (192919 => 192920)


--- trunk/Source/WTF/wtf/text/AtomicString.h	2015-12-01 22:47:00 UTC (rev 192919)
+++ trunk/Source/WTF/wtf/text/AtomicString.h	2015-12-01 23:30:03 UTC (rev 192920)
@@ -88,6 +88,8 @@
     AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDeletedValue) { }
     bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedValue(); }
 
+    unsigned existingHash() const { return isNull() ? 0 : impl()->existingHash(); }
+
     operator const String&() const { return m_string; }
     const String& string() const { return m_string; };
 

Modified: trunk/Source/WTF/wtf/text/WTFString.h (192919 => 192920)


--- trunk/Source/WTF/wtf/text/WTFString.h	2015-12-01 22:47:00 UTC (rev 192919)
+++ trunk/Source/WTF/wtf/text/WTFString.h	2015-12-01 23:30:03 UTC (rev 192920)
@@ -463,6 +463,8 @@
     String(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue) { }
     bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue(); }
 
+    unsigned existingHash() const { return isNull() ? 0 : impl()->existingHash(); }
+
 #ifndef NDEBUG
     WTF_EXPORT_STRING_API void show() const;
 #endif

Modified: trunk/Source/WebCore/ChangeLog (192919 => 192920)


--- trunk/Source/WebCore/ChangeLog	2015-12-01 22:47:00 UTC (rev 192919)
+++ trunk/Source/WebCore/ChangeLog	2015-12-01 23:30:03 UTC (rev 192920)
@@ -1,5 +1,17 @@
 2015-12-01  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        Give String and AtomicString an existingHash() function
+        https://bugs.webkit.org/show_bug.cgi?id=151717
+
+        Reviewed by Andreas Kling.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/Font.cpp:
+        (WebCore::CharacterFallbackMapKeyHash::hash):
+
+2015-12-01  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         [Win] Build fix after r192895
 
         Unreviewed.

Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (192919 => 192920)


--- trunk/Source/WebCore/platform/graphics/Font.cpp	2015-12-01 22:47:00 UTC (rev 192919)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp	2015-12-01 23:30:03 UTC (rev 192920)
@@ -426,7 +426,7 @@
         IntegerHasher hasher;
         hasher.add(key.character);
         hasher.add(key.isForPlatformFont);
-        hasher.add(key.locale.isNull() ? 0 : key.locale.impl()->existingHash());
+        hasher.add(key.locale.existingHash());
         return hasher.hash();
     }
 

Modified: trunk/Tools/ChangeLog (192919 => 192920)


--- trunk/Tools/ChangeLog	2015-12-01 22:47:00 UTC (rev 192919)
+++ trunk/Tools/ChangeLog	2015-12-01 23:30:03 UTC (rev 192920)
@@ -1,3 +1,15 @@
+2015-12-01  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Give String and AtomicString an existingHash() function
+        https://bugs.webkit.org/show_bug.cgi?id=151717
+
+        Reviewed by Andreas Kling.
+
+        * TestWebKitAPI/Tests/WTF/AtomicString.cpp:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WTF/WTFString.cpp:
+        (TestWebKitAPI::TEST):
+
 2015-12-01  Yusuke Suzuki  <utatane....@gmail.com>
 
         [ES6] Implement LLInt/Baseline Support for ES6 Generators and enable this feature

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/AtomicString.cpp (192919 => 192920)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/AtomicString.cpp	2015-12-01 22:47:00 UTC (rev 192919)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/AtomicString.cpp	2015-12-01 23:30:03 UTC (rev 192920)
@@ -53,4 +53,12 @@
     ASSERT_EQ(string1.impl(), string3.impl());
 }
 
+TEST(WTF, AtomicStringExistingHash)
+{
+    AtomicString string1("Template Literal", AtomicString::ConstructFromLiteral);
+    ASSERT_EQ(string1.existingHash(), string1.impl()->existingHash());
+    AtomicString string2;
+    ASSERT_EQ(string2.existingHash(), 0u);
+}
+
 } // namespace TestWebKitAPI

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp (192919 => 192920)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp	2015-12-01 22:47:00 UTC (rev 192919)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp	2015-12-01 23:30:03 UTC (rev 192920)
@@ -281,4 +281,15 @@
     EXPECT_FALSE(String("Test").hasInfixStartingAt(String::fromUTF8("δΈ­"), 2));
 }
 
+TEST(WTF, StringExistingHash)
+{
+    String string1("Template Literal");
+    ASSERT_FALSE(string1.isNull());
+    ASSERT_FALSE(string1.impl()->hasHash());
+    string1.impl()->hash();
+    ASSERT_EQ(string1.existingHash(), string1.impl()->existingHash());
+    String string2;
+    ASSERT_EQ(string2.existingHash(), 0u);
+}
+
 } // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to