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..946eef0ee572068af9ddc95ff33485bda5a34830 100644 |
--- a/third_party/WebKit/Source/wtf/text/StringImpl.cpp |
+++ b/third_party/WebKit/Source/wtf/text/StringImpl.cpp |
@@ -32,6 +32,7 @@ |
#include "wtf/allocator/Partitions.h" |
#include "wtf/text/AtomicString.h" |
#include "wtf/text/AtomicStringTable.h" |
+#include "wtf/text/CString.h" |
#include "wtf/text/CharacterNames.h" |
#include "wtf/text/StringBuffer.h" |
#include "wtf/text/StringHash.h" |
@@ -54,8 +55,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 +327,13 @@ bool StringImpl::isSafeToSendToAnotherThread() const { |
return false; |
} |
+#if DCHECK_IS_ON() |
+std::string StringImpl::asciiForDebugging() const { |
+ CString ascii = String(this->isolatedCopy()).left(128).ascii(); |
esprehn
2017/01/12 23:00:00
just use substring, that's all left() does anyway:
Charlie Harrison
2017/01/13 17:42:25
substring is not const because it can ref |this| (
|
+ return std::string(ascii.data(), ascii.length()); |
+} |
+#endif |
+ |
PassRefPtr<StringImpl> StringImpl::createUninitialized(unsigned length, |
LChar*& data) { |
if (!length) { |