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

Side by Side Diff: third_party/WebKit/Source/wtf/text/AtomicString.h

Issue 2546473004: Add comments to wtf/AtomciString.h. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 16 matching lines...) Expand all
27 #include "wtf/text/CString.h" 27 #include "wtf/text/CString.h"
28 #include "wtf/text/StringView.h" 28 #include "wtf/text/StringView.h"
29 #include "wtf/text/WTFString.h" 29 #include "wtf/text/WTFString.h"
30 #include <cstring> 30 #include <cstring>
31 #include <iosfwd> 31 #include <iosfwd>
32 32
33 namespace WTF { 33 namespace WTF {
34 34
35 struct AtomicStringHash; 35 struct AtomicStringHash;
36 36
37 // An AtomicString instance represents a string, and multiple AtomicString
38 // instances shares their string storage if the strings are identical. Comparing
kochi 2016/12/01 07:02:26 s/shares/can share/
tkent 2016/12/01 07:09:17 Done.
39 // two AtomicString instances is much faster than comparing two String instances
40 // because we just check string storage identity.
41 //
42 // AtomicString instances are not tread-safe. An AtomicString instance created
kochi 2016/12/01 07:02:26 s/tread/thread/
tkent 2016/12/01 07:09:17 Done.
43 // in a thread must be used only in the creator thread. If multiple threads
44 // access a single AtomicString instance, we have race condition of a reference
45 // count in StringImpl, and would hit a runtime CHECK in
46 // AtomicStringTable::remove().
47 //
48 // Exception: nullAtom and emptyAtom, are shared in multiple threads, and are
49 // never stored in AtomicStringTable.
37 class WTF_EXPORT AtomicString { 50 class WTF_EXPORT AtomicString {
38 USING_FAST_MALLOC(AtomicString); 51 USING_FAST_MALLOC(AtomicString);
39 52
40 public: 53 public:
54 // The function is defined in StringStatics.cpp.
41 static void init(); 55 static void init();
42 56
43 AtomicString() {} 57 AtomicString() {}
44 AtomicString(const LChar* chars) 58 AtomicString(const LChar* chars)
45 : AtomicString(chars, 59 : AtomicString(chars,
46 chars ? strlen(reinterpret_cast<const char*>(chars)) : 0) { 60 chars ? strlen(reinterpret_cast<const char*>(chars)) : 0) {
47 } 61 }
48 AtomicString(const char* chars) 62 AtomicString(const char* chars)
49 : AtomicString(reinterpret_cast<const LChar*>(chars)) {} 63 : AtomicString(reinterpret_cast<const LChar*>(chars)) {}
50 AtomicString(const LChar* chars, unsigned length); 64 AtomicString(const LChar* chars, unsigned length);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 using WTF::AtomicString; 320 using WTF::AtomicString;
307 using WTF::nullAtom; 321 using WTF::nullAtom;
308 using WTF::emptyAtom; 322 using WTF::emptyAtom;
309 using WTF::starAtom; 323 using WTF::starAtom;
310 using WTF::xmlAtom; 324 using WTF::xmlAtom;
311 using WTF::xmlnsAtom; 325 using WTF::xmlnsAtom;
312 using WTF::xlinkAtom; 326 using WTF::xlinkAtom;
313 327
314 #include "wtf/text/StringConcatenate.h" 328 #include "wtf/text/StringConcatenate.h"
315 #endif // AtomicString_h 329 #endif // AtomicString_h
OLDNEW
« 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