Title: [132734] trunk/Source/WebKit2
Revision
132734
Author
[email protected]
Date
2012-10-27 11:17:30 -0700 (Sat, 27 Oct 2012)

Log Message

buildHTTPHeaders() should use a StringBuilder instead of a Vector<UChar>
https://bugs.webkit.org/show_bug.cgi?id=100580

Reviewed by Oliver Hunt.

Replaced Vector<UChar> with StringBuilder in the HTTP header construction function buildHTTPHeaders.
This eliminates 8 -> 16 bit up conversion of the strings involved.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::buildHTTPHeaders):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (132733 => 132734)


--- trunk/Source/WebKit2/ChangeLog	2012-10-27 18:16:01 UTC (rev 132733)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-27 18:17:30 UTC (rev 132734)
@@ -1,3 +1,16 @@
+2012-10-27  Michael Saboff  <[email protected]>
+
+        buildHTTPHeaders() should use a StringBuilder instead of a Vector<UChar>
+        https://bugs.webkit.org/show_bug.cgi?id=100580
+
+        Reviewed by Oliver Hunt.
+
+        Replaced Vector<UChar> with StringBuilder in the HTTP header construction function buildHTTPHeaders.
+        This eliminates 8 -> 16 bit up conversion of the strings involved.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::buildHTTPHeaders):
+
 2012-10-27  Dan Bernstein  <[email protected]>
 
         REAL_PLATFORM_NAME build setting is no longer needed

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (132733 => 132734)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-10-27 18:16:01 UTC (rev 132733)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-10-27 18:17:30 UTC (rev 132734)
@@ -61,6 +61,7 @@
 #include <WebCore/SecurityPolicy.h>
 #include <WebCore/Settings.h>
 #include <WebCore/UserGestureIndicator.h>
+#include <wtf/text/StringBuilder.h>
 
 using namespace JSC;
 using namespace WebCore;
@@ -162,23 +163,23 @@
     if (!response.isHTTP())
         return String();
 
-    Vector<UChar> stringBuilder;
+    StringBuilder stringBuilder;
     String separator(": ");
     
     String statusLine = String::format("HTTP %d ", response.httpStatusCode());
-    stringBuilder.append(statusLine.characters(), statusLine.length());
-    stringBuilder.append(response.httpStatusText().characters(), response.httpStatusText().length());
+    stringBuilder.append(statusLine);
+    stringBuilder.append(response.httpStatusText());
     stringBuilder.append('\n');
     
     HTTPHeaderMap::const_iterator end = response.httpHeaderFields().end();
     for (HTTPHeaderMap::const_iterator it = response.httpHeaderFields().begin(); it != end; ++it) {
-        stringBuilder.append(it->key.characters(), it->key.length());
-        stringBuilder.append(separator.characters(), separator.length());
-        stringBuilder.append(it->value.characters(), it->value.length());
+        stringBuilder.append(it->key);
+        stringBuilder.append(separator);
+        stringBuilder.append(it->value);
         stringBuilder.append('\n');
     }
     
-    String headers = String::adopt(stringBuilder);
+    String headers = stringBuilder.toString();
     
     // If the content is encoded (most likely compressed), then don't send its length to the plugin,
     // which is only interested in the decoded length, not yet known at the moment.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to