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

Unified Diff: third_party/WebKit/Source/core/fetch/TextResource.cpp

Issue 1431863004: Avoid merging SharedBuffer segments in TextResource::decodedText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/TextResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/TextResource.cpp b/third_party/WebKit/Source/core/fetch/TextResource.cpp
index 5ec44e320521e772a3ed5da960bfb08142eb9c8f..3286b8005d75b57868c172005291c070c14dfec6 100644
--- a/third_party/WebKit/Source/core/fetch/TextResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/TextResource.cpp
@@ -7,6 +7,7 @@
#include "core/html/parser/TextResourceDecoder.h"
#include "platform/SharedBuffer.h"
+#include "wtf/text/StringBuilder.h"
namespace blink {
@@ -34,9 +35,15 @@ String TextResource::decodedText() const
{
ASSERT(m_data);
- String text = m_decoder->decode(m_data->data(), encodedSize());
- text.append(m_decoder->flush());
- return text;
+ StringBuilder builder;
+ const char* data;
+ unsigned position = 0;
+ while (unsigned length = m_data->getSomeData(data, position)) {
+ builder.append(m_decoder->decode(data, length));
+ position += length;
+ }
+ builder.append(m_decoder->flush());
+ return builder.toString();
}
} // namespace blink
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698