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

Unified Diff: third_party/WebKit/Source/wtf/text/StringImpl.cpp

Issue 2624443003: Enable ThreadRestrictionVerifier for StringImpl (Closed)
Patch Set: Get rid of vestigial debugging code Created 3 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: 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) {

Powered by Google App Engine
This is Rietveld 408576698