Title: [187812] trunk/Source/WebKit2
Revision
187812
Author
[email protected]
Date
2015-08-03 22:01:51 -0700 (Mon, 03 Aug 2015)

Log Message

[WK2] Reserve Vector capacity in VectorArgumentCoder<false, T, inlineCapacity>::decode()
https://bugs.webkit.org/show_bug.cgi?id=147619

Reviewed by Andreas Kling.

Reserve Vector capacity in VectorArgumentCoder<false, T, inlineCapacity>::decode()
as we know the size of the Vector in advance.

* Platform/IPC/ArgumentCoders.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (187811 => 187812)


--- trunk/Source/WebKit2/ChangeLog	2015-08-04 04:45:10 UTC (rev 187811)
+++ trunk/Source/WebKit2/ChangeLog	2015-08-04 05:01:51 UTC (rev 187812)
@@ -1,3 +1,15 @@
+2015-08-03  Chris Dumez  <[email protected]>
+
+        [WK2] Reserve Vector capacity in VectorArgumentCoder<false, T, inlineCapacity>::decode()
+        https://bugs.webkit.org/show_bug.cgi?id=147619
+
+        Reviewed by Andreas Kling.
+
+        Reserve Vector capacity in VectorArgumentCoder<false, T, inlineCapacity>::decode()
+        as we know the size of the Vector in advance.
+
+        * Platform/IPC/ArgumentCoders.h:
+
 2015-08-03  Gyuyoung Kim  <[email protected]>
 
         [CoordinatedGraphics] Rearrange uses of USE_COORDINATED_GRAPHICS_MULTIPROCESS

Modified: trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h (187811 => 187812)


--- trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h	2015-08-04 04:45:10 UTC (rev 187811)
+++ trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h	2015-08-04 05:01:51 UTC (rev 187812)
@@ -164,15 +164,15 @@
             return false;
 
         Vector<T, inlineCapacity> tmp;
+        tmp.reserveInitialCapacity(size);
         for (size_t i = 0; i < size; ++i) {
             T element;
             if (!decoder.decode(element))
                 return false;
             
-            tmp.append(WTF::move(element));
+            tmp.uncheckedAppend(WTF::move(element));
         }
 
-        tmp.shrinkToFit();
         vector.swap(tmp);
         return true;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to