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

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

Issue 2335573003: Move String::isSafeToSendToAnotherThread to StringImpl. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringImpl.h ('k') | third_party/WebKit/Source/wtf/text/WTFString.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bb0eaeb4b05b34f5917021c8bf8eb9fe616a3bd9..04646b4b68998fd4660b77d52112bd556d77abba 100644
--- a/third_party/WebKit/Source/wtf/text/StringImpl.cpp
+++ b/third_party/WebKit/Source/wtf/text/StringImpl.cpp
@@ -286,6 +286,19 @@ void StringImpl::destroyIfNotStatic()
delete this;
}
+bool StringImpl::isSafeToSendToAnotherThread() const
+{
+ if (isStatic())
+ return true;
+ // AtomicStrings are not safe to send between threads as ~StringImpl()
+ // will try to remove them from the wrong AtomicStringTable.
+ if (isAtomic())
+ return false;
+ if (hasOneRef())
+ return true;
+ return false;
+}
+
PassRefPtr<StringImpl> StringImpl::createUninitialized(unsigned length, LChar*& data)
{
if (!length) {
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringImpl.h ('k') | third_party/WebKit/Source/wtf/text/WTFString.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698