Title: [143563] trunk/Source/WebCore
Revision
143563
Author
[email protected]
Date
2013-02-20 21:36:42 -0800 (Wed, 20 Feb 2013)

Log Message

WebVTTParser copies character buffer more often than necessary
https://bugs.webkit.org/show_bug.cgi?id=103319

Reviewed by Eric Carlson.

Previously this codepath was creating a String just to parse the timestamp
and then if the timestamp was valid, was creating a second string.
I've fixed it to only create one string and use it in both places.
I also fixed this codepath to use 8bit strings when possible, per the FIXME.

* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::constructTreeFromToken):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143562 => 143563)


--- trunk/Source/WebCore/ChangeLog	2013-02-21 04:58:08 UTC (rev 143562)
+++ trunk/Source/WebCore/ChangeLog	2013-02-21 05:36:42 UTC (rev 143563)
@@ -1,3 +1,18 @@
+2013-02-20  Eric Seidel  <[email protected]>
+
+        WebVTTParser copies character buffer more often than necessary
+        https://bugs.webkit.org/show_bug.cgi?id=103319
+
+        Reviewed by Eric Carlson.
+
+        Previously this codepath was creating a String just to parse the timestamp
+        and then if the timestamp was valid, was creating a second string.
+        I've fixed it to only create one string and use it in both places.
+        I also fixed this codepath to use 8bit strings when possible, per the FIXME.
+
+        * html/track/WebVTTParser.cpp:
+        (WebCore::WebVTTParser::constructTreeFromToken):
+
 2013-02-20  Mike West  <[email protected]>
 
         Mouseup event does not fire on Scroll Bar

Modified: trunk/Source/WebCore/html/track/WebVTTParser.cpp (143562 => 143563)


--- trunk/Source/WebCore/html/track/WebVTTParser.cpp	2013-02-21 04:58:08 UTC (rev 143562)
+++ trunk/Source/WebCore/html/track/WebVTTParser.cpp	2013-02-21 05:36:42 UTC (rev 143563)
@@ -418,10 +418,10 @@
     }
     case WebVTTTokenTypes::TimestampTag: {
         unsigned position = 0;
-        double time = collectTimeStamp(m_token.characters().data(), &position);
-        // FIXME: This should use an 8bit string if possible.
+        String charactersString(StringImpl::create8BitIfPossible(m_token.characters()));
+        double time = collectTimeStamp(charactersString, &position);
         if (time != malformedTime)
-            m_currentNode->parserAppendChild(ProcessingInstruction::create(document, "timestamp", String(m_token.characters())));
+            m_currentNode->parserAppendChild(ProcessingInstruction::create(document, "timestamp", charactersString));
         break;
     }
     default:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to