Title: [152951] trunk
Revision
152951
Author
[email protected]
Date
2013-07-21 12:05:56 -0700 (Sun, 21 Jul 2013)

Log Message

KURL creates duplicate strings when completing data: URIs.
<http://webkit.org/b/118952>
<rdar://problem/14504480>

Reviewed by Anders Carlsson.

Source/WebCore:

When checking if the original URL input string can be reused, compare against the part
of the parsing buffer that we would actually return, not the entire buffer.

632 kB progression on <http://www.nytimes.com/>

Test: KURLTest.KURLDataURIStringSharing

* platform/KURL.cpp:
(WebCore::KURL::parse):

Tools:

* TestWebKitAPI/Tests/WebCore/KURL.cpp:
(TestWebKitAPI::TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (152950 => 152951)


--- trunk/Source/WebCore/ChangeLog	2013-07-21 18:55:37 UTC (rev 152950)
+++ trunk/Source/WebCore/ChangeLog	2013-07-21 19:05:56 UTC (rev 152951)
@@ -1,3 +1,21 @@
+2013-07-21  Andreas Kling  <[email protected]>
+
+        KURL creates duplicate strings when completing data: URIs.
+        <http://webkit.org/b/118952>
+        <rdar://problem/14504480>
+
+        Reviewed by Anders Carlsson.
+
+        When checking if the original URL input string can be reused, compare against the part
+        of the parsing buffer that we would actually return, not the entire buffer.
+
+        632 kB progression on <http://www.nytimes.com/>
+
+        Test: KURLTest.KURLDataURIStringSharing
+
+        * platform/KURL.cpp:
+        (WebCore::KURL::parse):
+
 2013-07-20  Benjamin Poulain  <[email protected]>
 
         Add ASCIILiteral() on strings allocated often enough to appear in my Instruments

Modified: trunk/Source/WebCore/platform/KURL.cpp (152950 => 152951)


--- trunk/Source/WebCore/platform/KURL.cpp	2013-07-21 18:55:37 UTC (rev 152950)
+++ trunk/Source/WebCore/platform/KURL.cpp	2013-07-21 19:05:56 UTC (rev 152951)
@@ -1407,7 +1407,7 @@
 
     // If we didn't end up actually changing the original string and
     // it was already in a String, reuse it to avoid extra allocation.
-    if (originalString && *originalString == buffer)
+    if (originalString && equal(originalString->impl(), buffer.data(), m_fragmentEnd))
         m_string = *originalString;
     else
         m_string = String(buffer.data(), m_fragmentEnd);

Modified: trunk/Tools/ChangeLog (152950 => 152951)


--- trunk/Tools/ChangeLog	2013-07-21 18:55:37 UTC (rev 152950)
+++ trunk/Tools/ChangeLog	2013-07-21 19:05:56 UTC (rev 152951)
@@ -1,3 +1,14 @@
+2013-07-21  Andreas Kling  <[email protected]>
+
+        KURL creates duplicate strings when completing data: URIs.
+        <http://webkit.org/b/118952>
+        <rdar://problem/14504480>
+
+        Reviewed by Anders Carlsson.
+
+        * TestWebKitAPI/Tests/WebCore/KURL.cpp:
+        (TestWebKitAPI::TEST_F):
+
 2013-07-19  Chris Fleizach  <[email protected]>
 
         AX: VoiceOver not detecting misspelled words don't work in all cases

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/KURL.cpp (152950 => 152951)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/KURL.cpp	2013-07-21 18:55:37 UTC (rev 152950)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/KURL.cpp	2013-07-21 19:05:56 UTC (rev 152951)
@@ -72,4 +72,13 @@
     EXPECT_EQ(String("fragment"), kurl.fragmentIdentifier());
 }
 
+TEST_F(KURLTest, KURLDataURIStringSharing)
+{
+    KURL baseURL(ParsedURLString, "http://www.webkit.org/");
+    String threeApples = "data:text/plain;charset=utf-8;base64,76O/76O/76O/";
+
+    KURL url(baseURL, threeApples);
+    EXPECT_EQ(threeApples.impl(), url.string().impl());
+}
+
 } // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to