diff options
author | abarth@chromium.org <abarth@chromium.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2013-09-06 21:27:13 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2013-09-06 21:27:13 +0000 |
commit | 50369bdf4004565fd66e9c2603e7008544bfa4c9 (patch) | |
tree | ef5452dd7f002cc0edcaf839d1c1e89b9179a56c /third_party/WebKit/Source/wtf/text/StringBuffer.h | |
parent | 0496ea7579d5f244c773d1745407e5cf42580613 (diff) | |
download | chromium_src-50369bdf4004565fd66e9c2603e7008544bfa4c9.zip chromium_src-50369bdf4004565fd66e9c2603e7008544bfa4c9.tar.gz chromium_src-50369bdf4004565fd66e9c2603e7008544bfa4c9.tar.bz2 |
SerializedScriptValue's Writer calls realloc a lot
Currently SerializedScriptValue's Writer is resizing its StringBuffer to the
exact size it needs for every object it writes into the buffer. Instead, it
should grow the buffer exponentially to avoid calling realloc so many times.
This CL fixes a regression from Blink@155225. I've also removed a call to
isolatedCopy which is unnecessary.
R=jsbell@chromium.org
BUG=266837
Review URL: https://chromiumcodereview.appspot.com/24043003
git-svn-id: svn://svn.chromium.org/blink/trunk@157388 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/Source/wtf/text/StringBuffer.h')
-rw-r--r-- | third_party/WebKit/Source/wtf/text/StringBuffer.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/third_party/WebKit/Source/wtf/text/StringBuffer.h b/third_party/WebKit/Source/wtf/text/StringBuffer.h index 25be1ff..1b3b55d 100644 --- a/third_party/WebKit/Source/wtf/text/StringBuffer.h +++ b/third_party/WebKit/Source/wtf/text/StringBuffer.h @@ -73,7 +73,7 @@ public: shrink(newLength); } - unsigned length() const { return m_data->length(); } + unsigned length() const { return m_data ? m_data->length() : 0; } CharType* characters() { return length() ? const_cast<CharType*>(m_data->getCharacters<CharType>()) : 0; } CharType& operator[](unsigned i) { ASSERT_WITH_SECURITY_IMPLICATION(i < length()); return characters()[i]; } |