Index: third_party/WebKit/Source/wtf/text/StringImpl.cpp |
diff --git a/third_party/WebKit/Source/wtf/text/StringImpl.cpp b/third_party/WebKit/Source/wtf/text/StringImpl.cpp |
index 641fbc9c72c4b7aeecf2ff0d48498bb7d27e2e20..a74a1c57be92e27f52d8906cffa53bcc41e82f14 100644 |
--- a/third_party/WebKit/Source/wtf/text/StringImpl.cpp |
+++ b/third_party/WebKit/Source/wtf/text/StringImpl.cpp |
@@ -54,8 +54,10 @@ namespace WTF { |
using namespace Unicode; |
+#if !DCHECK_IS_ON() |
static_assert(sizeof(StringImpl) == 3 * sizeof(int), |
"StringImpl should stay small"); |
+#endif |
#ifdef STRING_STATS |
@@ -324,6 +326,18 @@ bool StringImpl::isSafeToSendToAnotherThread() const { |
return false; |
} |
+#if DCHECK_IS_ON() |
+std::string StringImpl::asciiForDebugging() const { |
+ const unsigned kMaxCheckLength = 64; |
+ std::string debugString; |
+ for (unsigned i = 0; i < length() && i < kMaxCheckLength; ++i) { |
+ UChar c = (*this)[i]; |
+ debugString.push_back(isASCIIPrintable(c) ? c : '?'); |
+ } |
+ return debugString; |
esprehn
2017/01/11 22:34:01
This function can be:
CString ascii = left(64).as
Charlie Harrison
2017/01/12 16:42:30
Ah right, for some reason I was concerned with pul
Charlie Harrison
2017/01/12 22:50:08
Actually, left is a function of String, so it woul
|
+} |
+#endif |
+ |
PassRefPtr<StringImpl> StringImpl::createUninitialized(unsigned length, |
LChar*& data) { |
if (!length) { |