Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1802)

Unified Diff: Source/modules/websockets/WebSocketHandshake.cpp

Issue 482753002: Use StringBuilder::appendLiteral() / StringBuilder::append(char) when possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/websockets/WebSocketExtensionDispatcher.cpp ('k') | Source/platform/JSONValues.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/websockets/WebSocketHandshake.cpp
diff --git a/Source/modules/websockets/WebSocketHandshake.cpp b/Source/modules/websockets/WebSocketHandshake.cpp
index edb9a8d8bee71a929bca2cb0653d42c044e99915..dff022bae5673f6f95da436e173e6fc05ed55352 100644
--- a/Source/modules/websockets/WebSocketHandshake.cpp
+++ b/Source/modules/websockets/WebSocketHandshake.cpp
@@ -174,8 +174,11 @@ String WebSocketHandshake::clientOrigin() const
String WebSocketHandshake::clientLocation() const
{
StringBuilder builder;
- builder.append(m_secure ? "wss" : "ws");
- builder.append("://");
+ if (m_secure)
+ builder.appendLiteral("wss");
+ else
+ builder.appendLiteral("ws");
+ builder.appendLiteral("://");
builder.append(hostName(m_url, m_secure));
builder.append(resourceName(m_url));
return builder.toString();
@@ -188,9 +191,9 @@ CString WebSocketHandshake::clientHandshakeMessage() const
// Keep the following consistent with clientHandshakeRequest().
StringBuilder builder;
- builder.append("GET ");
+ builder.appendLiteral("GET ");
builder.append(resourceName(m_url));
- builder.append(" HTTP/1.1\r\n");
+ builder.appendLiteral(" HTTP/1.1\r\n");
Vector<String> fields;
fields.append("Upgrade: websocket");
@@ -221,10 +224,10 @@ CString WebSocketHandshake::clientHandshakeMessage() const
for (size_t i = 0; i < fields.size(); i++) {
builder.append(fields[i]);
- builder.append("\r\n");
+ builder.appendLiteral("\r\n");
}
- builder.append("\r\n");
+ builder.appendLiteral("\r\n");
return builder.toString().utf8();
}
« no previous file with comments | « Source/modules/websockets/WebSocketExtensionDispatcher.cpp ('k') | Source/platform/JSONValues.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698