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

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

Issue 2624443003: Enable ThreadRestrictionVerifier for StringImpl (Closed)
Patch Set: rebase on TLS CL (inc. asan errors) 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..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) {

Powered by Google App Engine
This is Rietveld 408576698