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

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

Issue 1390033003: Remove StringImpl::reallocate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | third_party/WebKit/Source/wtf/text/StringImpl.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.cpp
diff --git a/third_party/WebKit/Source/wtf/text/StringBuilder.cpp b/third_party/WebKit/Source/wtf/text/StringBuilder.cpp
index 5b075f0a4403efe387f41999ab818ef4145c712d..f3a40bc3a4034c8a84f6452ff521bac0326ac028 100644
--- a/third_party/WebKit/Source/wtf/text/StringBuilder.cpp
+++ b/third_party/WebKit/Source/wtf/text/StringBuilder.cpp
@@ -167,12 +167,7 @@ void StringBuilder::reallocateBuffer<LChar>(unsigned requiredLength)
ASSERT(m_is8Bit);
ASSERT(m_buffer->is8Bit());
- if (m_buffer->hasOneRef()) {
- m_buffer = StringImpl::reallocate(m_buffer.release(), requiredLength);
- m_bufferCharacters8 = const_cast<LChar*>(m_buffer->characters8());
- } else {
- allocateBuffer(m_buffer->characters8(), requiredLength);
- }
+ allocateBuffer(m_buffer->characters8(), requiredLength);
}
template <>
@@ -182,14 +177,10 @@ void StringBuilder::reallocateBuffer<UChar>(unsigned requiredLength)
// otherwise fall back to "allocate and copy" method.
m_string = String();
- if (m_buffer->is8Bit()) {
+ if (m_buffer->is8Bit())
allocateBufferUpConvert(m_buffer->characters8(), requiredLength);
- } else if (m_buffer->hasOneRef()) {
- m_buffer = StringImpl::reallocate(m_buffer.release(), requiredLength);
- m_bufferCharacters16 = const_cast<UChar*>(m_buffer->characters16());
- } else {
+ else
allocateBuffer(m_buffer->characters16(), requiredLength);
- }
}
void StringBuilder::reserveCapacity(unsigned newCapacity)
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/text/StringImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698