Title: [170050] trunk/Source/WebCore
Revision
170050
Author
[email protected]
Date
2014-06-17 00:47:27 -0700 (Tue, 17 Jun 2014)

Log Message

Avoid Vector<char> copies in the OffsetBuffer constructor
https://bugs.webkit.org/show_bug.cgi?id=133956

Reviewed by Andreas Kling.

* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::OffsetBuffer::OffsetBuffer): Take the Vector parameter by value and
move it into the member variable.
(WebCore::openFunc): Move the Vector object into the OffsetBuffer constructor.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (170049 => 170050)


--- trunk/Source/WebCore/ChangeLog	2014-06-17 07:43:53 UTC (rev 170049)
+++ trunk/Source/WebCore/ChangeLog	2014-06-17 07:47:27 UTC (rev 170050)
@@ -1,3 +1,15 @@
+2014-06-17  Zan Dobersek  <[email protected]>
+
+        Avoid Vector<char> copies in the OffsetBuffer constructor
+        https://bugs.webkit.org/show_bug.cgi?id=133956
+
+        Reviewed by Andreas Kling.
+
+        * xml/parser/XMLDocumentParserLibxml2.cpp:
+        (WebCore::OffsetBuffer::OffsetBuffer): Take the Vector parameter by value and
+        move it into the member variable.
+        (WebCore::openFunc): Move the Vector object into the OffsetBuffer constructor.
+
 2014-06-17  Jer Noble  <[email protected]>
 
         [MSE] Overwritten samples are removed from buffered ranges using decode times; added samples using presentation times

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp (170049 => 170050)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp	2014-06-17 07:43:53 UTC (rev 170049)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp	2014-06-17 07:47:27 UTC (rev 170050)
@@ -361,7 +361,11 @@
 class OffsetBuffer {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    OffsetBuffer(const Vector<char>& b) : m_buffer(b), m_currentOffset(0) { }
+    OffsetBuffer(Vector<char> buffer)
+        : m_buffer(std::move(buffer))
+        , m_currentOffset(0)
+    {
+    }
 
     int readOutBytes(char* outputBuffer, unsigned askedToRead)
     {
@@ -465,7 +469,7 @@
     if (!shouldAllowExternalLoad(response.url()))
         return &globalDescriptor;
 
-    return new OffsetBuffer(data);
+    return new OffsetBuffer(std::move(data));
 }
 
 static int readFunc(void* context, char* buffer, int len)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to