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

Unified Diff: Source/core/fetch/ScriptResource.cpp

Issue 124943003: Remove 'String::append' from some of the blink source. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Incorporated review comments Created 6 years, 11 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
Index: Source/core/fetch/ScriptResource.cpp
diff --git a/Source/core/fetch/ScriptResource.cpp b/Source/core/fetch/ScriptResource.cpp
old mode 100644
new mode 100755
index 873ef3322722f711ff22d971252932b792fd5174..9137c80d61d3c7c37a206765e083f63b236eedb8
--- a/Source/core/fetch/ScriptResource.cpp
+++ b/Source/core/fetch/ScriptResource.cpp
@@ -31,6 +31,7 @@
#include "platform/MIMETypeRegistry.h"
#include "platform/SharedBuffer.h"
#include "platform/network/HTTPParsers.h"
+#include "wtf/text/StringBuilder.h"
namespace WebCore {
@@ -71,14 +72,15 @@ const String& ScriptResource::script()
ASSERT(isLoaded());
if (!m_script && m_data) {
- String script = m_decoder->decode(m_data->data(), encodedSize());
+ StringBuilder script;
+ script.append(m_decoder->decode(m_data->data(), encodedSize()));
script.append(m_decoder->flush());
m_data.clear();
// We lie a it here and claim that script counts as encoded data (even though it's really decoded data).
// That's because the MemoryCache thinks that it can clear out decoded data by calling destroyDecodedData(),
// but we can't destroy script in destroyDecodedData because that's our only copy of the data!
setEncodedSize(script.sizeInBytes());
- m_script = script;
+ m_script = script.toString();
}
return m_script.string();

Powered by Google App Engine
This is Rietveld 408576698