Title: [146899] trunk/Source/WebCore
Revision
146899
Author
ch.du...@sisa.samsung.com
Date
2013-03-26 10:04:52 -0700 (Tue, 26 Mar 2013)

Log Message

HTTPHeaderMap::copyData() could call uncheckedAppend()
https://bugs.webkit.org/show_bug.cgi?id=113279

Reviewed by Alexey Proskuryakov.

HTTPHeaderMap::copyData() calls reserveInitialCapacity() on the Vector
but then appends items using append() function. Since we already know
the capacity is sufficient, it is more efficient to call uncheckedAppend()
instead to bypass capacity checks.

No new tests, no behavior change for layout tests.

* platform/network/HTTPHeaderMap.cpp:
(WebCore::HTTPHeaderMap::copyData):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (146898 => 146899)


--- trunk/Source/WebCore/ChangeLog	2013-03-26 17:01:36 UTC (rev 146898)
+++ trunk/Source/WebCore/ChangeLog	2013-03-26 17:04:52 UTC (rev 146899)
@@ -1,3 +1,20 @@
+2013-03-26  Christophe Dumez  <ch.du...@sisa.samsung.com>
+
+        HTTPHeaderMap::copyData() could call uncheckedAppend()
+        https://bugs.webkit.org/show_bug.cgi?id=113279
+
+        Reviewed by Alexey Proskuryakov.
+
+        HTTPHeaderMap::copyData() calls reserveInitialCapacity() on the Vector
+        but then appends items using append() function. Since we already know
+        the capacity is sufficient, it is more efficient to call uncheckedAppend()
+        instead to bypass capacity checks.
+
+        No new tests, no behavior change for layout tests.
+
+        * platform/network/HTTPHeaderMap.cpp:
+        (WebCore::HTTPHeaderMap::copyData):
+
 2013-03-26  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: UISourceCodes are leaking on reload sometimes.

Modified: trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp (146898 => 146899)


--- trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp	2013-03-26 17:01:36 UTC (rev 146898)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp	2013-03-26 17:04:52 UTC (rev 146899)
@@ -51,9 +51,9 @@
     data->reserveInitialCapacity(size());
 
     HTTPHeaderMap::const_iterator end_it = end();
-    for (HTTPHeaderMap::const_iterator it = begin(); it != end_it; ++it) {
-        data->append(make_pair(it->key.string().isolatedCopy(), it->value.isolatedCopy()));
-    }
+    for (HTTPHeaderMap::const_iterator it = begin(); it != end_it; ++it)
+        data->uncheckedAppend(make_pair(it->key.string().isolatedCopy(), it->value.isolatedCopy()));
+
     return data.release();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to