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

Unified Diff: third_party/WebKit/Source/wtf/text/StringBuilder.h

Issue 2007103003: Expand WTF::StringView's API to be more like StringPiece. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove bad assert. Created 4 years, 7 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 | « third_party/WebKit/Source/wtf/Forward.h ('k') | third_party/WebKit/Source/wtf/text/StringView.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/text/StringBuilder.h
diff --git a/third_party/WebKit/Source/wtf/text/StringBuilder.h b/third_party/WebKit/Source/wtf/text/StringBuilder.h
index 73cc2655e83cf11ef4f42de10b749a4c8ea74ab4..527efaea5ffc88f308e2ac323090b805875e4d97 100644
--- a/third_party/WebKit/Source/wtf/text/StringBuilder.h
+++ b/third_party/WebKit/Source/wtf/text/StringBuilder.h
@@ -29,6 +29,7 @@
#include "wtf/WTFExport.h"
#include "wtf/text/AtomicString.h"
+#include "wtf/text/StringView.h"
#include "wtf/text/WTFString.h"
namespace WTF {
@@ -50,26 +51,6 @@ public:
ALWAYS_INLINE void append(const char* characters, unsigned length) { append(reinterpret_cast<const LChar*>(characters), length); }
- void append(const String& string)
- {
- if (!string.length())
- return;
-
- // If we're appending to an empty string, and there is not a buffer (reserveCapacity has not been called)
- // then just retain the string.
- if (!m_length && !m_buffer) {
- m_string = string;
- m_length = string.length();
- m_is8Bit = m_string.is8Bit();
- return;
- }
-
- if (string.is8Bit())
- append(string.characters8(), string.length());
- else
- append(string.characters16(), string.length());
- }
-
void append(const StringBuilder& other)
{
if (!other.m_length)
@@ -89,7 +70,9 @@ public:
append(other.characters16(), other.m_length);
}
- void append(const String& string, unsigned offset, unsigned length)
+ // TODO(esprehn): This method is just duplicating what StringView itself
+ // does. Remove it and replace callers with append(StringView(string, offset, length)).
+ void append(const StringView& string, unsigned offset, unsigned length)
{
if (!string.length())
return;
@@ -115,12 +98,6 @@ public:
append(string.characters16(), string.length());
}
- void append(const char* characters)
- {
- if (characters)
- append(characters, strlen(characters));
- }
-
void append(UChar c)
{
if (m_buffer && m_length < m_buffer->length() && m_string.isNull()) {
« no previous file with comments | « third_party/WebKit/Source/wtf/Forward.h ('k') | third_party/WebKit/Source/wtf/text/StringView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698