OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 StringImpl* StringImpl::empty() | 41 StringImpl* StringImpl::empty() |
42 { | 42 { |
43 DEFINE_STATIC_LOCAL(StringImpl, emptyString, (ConstructEmptyString)); | 43 DEFINE_STATIC_LOCAL(StringImpl, emptyString, (ConstructEmptyString)); |
44 WTF_ANNOTATE_BENIGN_RACE(&emptyString, "Benign race on StringImpl::emptyStri
ng reference counter"); | 44 WTF_ANNOTATE_BENIGN_RACE(&emptyString, "Benign race on StringImpl::emptyStri
ng reference counter"); |
45 return &emptyString; | 45 return &emptyString; |
46 } | 46 } |
47 | 47 |
48 WTF_EXPORT DEFINE_GLOBAL(AtomicString, nullAtom) | 48 WTF_EXPORT DEFINE_GLOBAL(AtomicString, nullAtom) |
49 WTF_EXPORT DEFINE_GLOBAL(AtomicString, emptyAtom) | 49 WTF_EXPORT DEFINE_GLOBAL(AtomicString, emptyAtom) |
50 WTF_EXPORT DEFINE_GLOBAL(AtomicString, textAtom) | |
51 WTF_EXPORT DEFINE_GLOBAL(AtomicString, commentAtom) | |
52 WTF_EXPORT DEFINE_GLOBAL(AtomicString, starAtom) | 50 WTF_EXPORT DEFINE_GLOBAL(AtomicString, starAtom) |
53 WTF_EXPORT DEFINE_GLOBAL(AtomicString, xmlAtom) | 51 WTF_EXPORT DEFINE_GLOBAL(AtomicString, xmlAtom) |
54 WTF_EXPORT DEFINE_GLOBAL(AtomicString, xmlnsAtom) | 52 WTF_EXPORT DEFINE_GLOBAL(AtomicString, xmlnsAtom) |
55 WTF_EXPORT DEFINE_GLOBAL(AtomicString, xlinkAtom) | 53 WTF_EXPORT DEFINE_GLOBAL(AtomicString, xlinkAtom) |
56 | 54 |
57 NEVER_INLINE unsigned StringImpl::hashSlowCase() const | 55 NEVER_INLINE unsigned StringImpl::hashSlowCase() const |
58 { | 56 { |
59 if (is8Bit()) | 57 if (is8Bit()) |
60 setHash(StringHasher::computeHashAndMaskTop8Bits(characters8(), m_length
)); | 58 setHash(StringHasher::computeHashAndMaskTop8Bits(characters8(), m_length
)); |
61 else | 59 else |
62 setHash(StringHasher::computeHashAndMaskTop8Bits(characters16(), m_lengt
h)); | 60 setHash(StringHasher::computeHashAndMaskTop8Bits(characters16(), m_lengt
h)); |
63 return existingHash(); | 61 return existingHash(); |
64 } | 62 } |
65 | 63 |
66 void AtomicString::init() | 64 void AtomicString::init() |
67 { | 65 { |
68 ASSERT(isMainThread()); | 66 ASSERT(isMainThread()); |
69 | 67 |
70 new (NotNull, (void*)&nullAtom) AtomicString; | 68 new (NotNull, (void*)&nullAtom) AtomicString; |
71 new (NotNull, (void*)&emptyAtom) AtomicString(""); | 69 new (NotNull, (void*)&emptyAtom) AtomicString(""); |
72 } | 70 } |
73 | 71 |
74 void StringStatics::init() | 72 void StringStatics::init() |
75 { | 73 { |
76 ASSERT(isMainThread()); | 74 ASSERT(isMainThread()); |
77 | 75 |
78 // FIXME: These should be allocated at compile time. | 76 // FIXME: These should be allocated at compile time. |
79 new (NotNull, (void*)&textAtom) AtomicString("#text", AtomicString::Construc
tFromLiteral); | |
80 new (NotNull, (void*)&commentAtom) AtomicString("#comment", AtomicString::Co
nstructFromLiteral); | |
81 new (NotNull, (void*)&starAtom) AtomicString("*", AtomicString::ConstructFro
mLiteral); | 77 new (NotNull, (void*)&starAtom) AtomicString("*", AtomicString::ConstructFro
mLiteral); |
82 new (NotNull, (void*)&xmlAtom) AtomicString("xml", AtomicString::ConstructFr
omLiteral); | 78 new (NotNull, (void*)&xmlAtom) AtomicString("xml", AtomicString::ConstructFr
omLiteral); |
83 new (NotNull, (void*)&xmlnsAtom) AtomicString("xmlns", AtomicString::Constru
ctFromLiteral); | 79 new (NotNull, (void*)&xmlnsAtom) AtomicString("xmlns", AtomicString::Constru
ctFromLiteral); |
84 new (NotNull, (void*)&xlinkAtom) AtomicString("xlink", AtomicString::Constru
ctFromLiteral); | 80 new (NotNull, (void*)&xlinkAtom) AtomicString("xlink", AtomicString::Constru
ctFromLiteral); |
85 } | 81 } |
86 | 82 |
87 } | 83 } |
OLD | NEW |