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

Side by Side Diff: Source/modules/websockets/DOMWebSocket.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 return true; 181 return true;
182 } 182 }
183 183
184 static String encodeSubprotocolString(const String& protocol) 184 static String encodeSubprotocolString(const String& protocol)
185 { 185 {
186 StringBuilder builder; 186 StringBuilder builder;
187 for (size_t i = 0; i < protocol.length(); i++) { 187 for (size_t i = 0; i < protocol.length(); i++) {
188 if (protocol[i] < 0x20 || protocol[i] > 0x7E) 188 if (protocol[i] < 0x20 || protocol[i] > 0x7E)
189 builder.append(String::format("\\u%04X", protocol[i])); 189 builder.append(String::format("\\u%04X", protocol[i]));
190 else if (protocol[i] == 0x5c) 190 else if (protocol[i] == 0x5c)
191 builder.append("\\\\"); 191 builder.appendLiteral("\\\\");
192 else 192 else
193 builder.append(protocol[i]); 193 builder.append(protocol[i]);
194 } 194 }
195 return builder.toString(); 195 return builder.toString();
196 } 196 }
197 197
198 static String joinStrings(const Vector<String>& strings, const char* separator) 198 static String joinStrings(const Vector<String>& strings, const char* separator)
199 { 199 {
200 StringBuilder builder; 200 StringBuilder builder;
201 for (size_t i = 0; i < strings.size(); ++i) { 201 for (size_t i = 0; i < strings.size(); ++i) {
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 688
689 void DOMWebSocket::trace(Visitor* visitor) 689 void DOMWebSocket::trace(Visitor* visitor)
690 { 690 {
691 visitor->trace(m_channel); 691 visitor->trace(m_channel);
692 visitor->trace(m_eventQueue); 692 visitor->trace(m_eventQueue);
693 WebSocketChannelClient::trace(visitor); 693 WebSocketChannelClient::trace(visitor);
694 EventTargetWithInlineData::trace(visitor); 694 EventTargetWithInlineData::trace(visitor);
695 } 695 }
696 696
697 } // namespace blink 697 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/filesystem/DOMFileSystemBase.cpp ('k') | Source/modules/websockets/WebSocketExtensionDispatcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698