Title: [152625] trunk/Source/WTF
- Revision
- 152625
- Author
- [email protected]
- Date
- 2013-07-15 01:08:51 -0700 (Mon, 15 Jul 2013)
Log Message
Minor cleaning of AtomicString::addSlowCase
https://bugs.webkit.org/show_bug.cgi?id=118615
Reviewed by Geoffrey Garen.
Give the variable a proper name.
Add assertions to clarify the in and out states.
* wtf/text/AtomicString.cpp:
(WTF::AtomicString::addSlowCase):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (152624 => 152625)
--- trunk/Source/WTF/ChangeLog 2013-07-15 06:41:06 UTC (rev 152624)
+++ trunk/Source/WTF/ChangeLog 2013-07-15 08:08:51 UTC (rev 152625)
@@ -1,3 +1,16 @@
+2013-07-15 Benjamin Poulain <[email protected]>
+
+ Minor cleaning of AtomicString::addSlowCase
+ https://bugs.webkit.org/show_bug.cgi?id=118615
+
+ Reviewed by Geoffrey Garen.
+
+ Give the variable a proper name.
+ Add assertions to clarify the in and out states.
+
+ * wtf/text/AtomicString.cpp:
+ (WTF::AtomicString::addSlowCase):
+
2013-07-12 Mikhail Pozdnyakov <[email protected]>
Improve StringImpl::constructInternal() method
Modified: trunk/Source/WTF/wtf/text/AtomicString.cpp (152624 => 152625)
--- trunk/Source/WTF/wtf/text/AtomicString.cpp 2013-07-15 06:41:06 UTC (rev 152624)
+++ trunk/Source/WTF/wtf/text/AtomicString.cpp 2013-07-15 08:08:51 UTC (rev 152625)
@@ -377,16 +377,22 @@
return addToStringTable<CharBuffer, CharBufferFromLiteralDataTranslator>(buffer);
}
-PassRefPtr<StringImpl> AtomicString::addSlowCase(StringImpl* r)
+PassRefPtr<StringImpl> AtomicString::addSlowCase(StringImpl* string)
{
- if (!r->length())
+ if (!string->length())
return StringImpl::empty();
+ ASSERT_WITH_MESSAGE(!string->isAtomic(), "AtomicString should not hit the slow case if the string is already atomic.");
+
AtomicStringTableLocker locker;
- StringImpl* result = *stringTable().add(r).iterator;
- if (result == r)
- r->setIsAtomic(true);
- return result;
+ HashSet<StringImpl*>::AddResult addResult = stringTable().add(string);
+
+ if (addResult.isNewEntry) {
+ ASSERT(*addResult.iterator == string);
+ string->setIsAtomic(true);
+ }
+
+ return *addResult.iterator;
}
template<typename CharacterType>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes