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

Unified Diff: third_party/WebKit/Source/wtf/text/AtomicString.h

Issue 2546473004: Add comments to wtf/AtomciString.h. (Closed)
Patch Set: s Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/text/AtomicString.h
diff --git a/third_party/WebKit/Source/wtf/text/AtomicString.h b/third_party/WebKit/Source/wtf/text/AtomicString.h
index 9fc2eb654dd113d4e645d2047b90b72d19d190b4..7d8fb3595f220d31e457e73793d82c71b79a86a2 100644
--- a/third_party/WebKit/Source/wtf/text/AtomicString.h
+++ b/third_party/WebKit/Source/wtf/text/AtomicString.h
@@ -34,10 +34,24 @@ namespace WTF {
struct AtomicStringHash;
+// An AtomicString instance represents a string, and multiple AtomicString
+// instances can share their string storage if the strings are
+// identical. Comparing two AtomicString instances is much faster than comparing
+// two String instances because we just check string storage identity.
+//
+// AtomicString instances are not thread-safe. An AtomicString instance created
+// in a thread must be used only in the creator thread. If multiple threads
+// access a single AtomicString instance, we have race condition of a reference
+// count in StringImpl, and would hit a runtime CHECK in
+// AtomicStringTable::remove().
+//
+// Exception: nullAtom and emptyAtom, are shared in multiple threads, and are
+// never stored in AtomicStringTable.
class WTF_EXPORT AtomicString {
USING_FAST_MALLOC(AtomicString);
public:
+ // The function is defined in StringStatics.cpp.
static void init();
AtomicString() {}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698