X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fwtf%2Ftext%2FStringImpl.h;h=10f04390a1918c7b009cae67e094d7bfd75dee0c;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=552150734991558af89cc51e87c0b9f2b0f3c79b;hpb=7338fba38ba696536d1cc9d389afd716a6ab2fe6;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/wtf/text/StringImpl.h b/src/third_party/WebKit/Source/wtf/text/StringImpl.h index 5521507..10f0439 100644 --- a/src/third_party/WebKit/Source/wtf/text/StringImpl.h +++ b/src/third_party/WebKit/Source/wtf/text/StringImpl.h @@ -204,8 +204,7 @@ public: // Reallocate the StringImpl. The originalString must be only owned by the PassRefPtr. // Just like the input pointer of realloc(), the originalString can't be used after this function. - static PassRefPtr reallocate(PassRefPtr originalString, unsigned length, LChar*& data); - static PassRefPtr reallocate(PassRefPtr originalString, unsigned length, UChar*& data); + static PassRefPtr reallocate(PassRefPtr originalString, unsigned length); // If this StringImpl has only one reference, we can truncate the string by updating // its m_length property without actually re-allocating its buffer. @@ -435,6 +434,12 @@ public: #endif private: + template static size_t allocationSize(unsigned length) + { + RELEASE_ASSERT(length <= ((std::numeric_limits::max() - sizeof(StringImpl)) / sizeof(CharType))); + return sizeof(StringImpl) + length * sizeof(CharType); + } + // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings. static const unsigned s_copyCharsInlineCutOff = 20;