| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 NEVER_INLINE unsigned StringImpl::hashSlowCase() const { | 65 NEVER_INLINE unsigned StringImpl::hashSlowCase() const { |
| 66 if (is8Bit()) | 66 if (is8Bit()) |
| 67 setHash(StringHasher::computeHashAndMaskTop8Bits(characters8(), m_length)); | 67 setHash(StringHasher::computeHashAndMaskTop8Bits(characters8(), m_length)); |
| 68 else | 68 else |
| 69 setHash(StringHasher::computeHashAndMaskTop8Bits(characters16(), m_length)); | 69 setHash(StringHasher::computeHashAndMaskTop8Bits(characters16(), m_length)); |
| 70 return existingHash(); | 70 return existingHash(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void AtomicString::init() { | 73 void AtomicString::init() { |
| 74 ASSERT(isMainThread()); | 74 DCHECK(isMainThread()); |
| 75 | 75 |
| 76 new (NotNull, (void*)&nullAtom) AtomicString; | 76 new (NotNull, (void*)&nullAtom) AtomicString; |
| 77 new (NotNull, (void*)&emptyAtom) AtomicString(""); | 77 new (NotNull, (void*)&emptyAtom) AtomicString(""); |
| 78 } | 78 } |
| 79 | 79 |
| 80 template <unsigned charactersCount> | 80 template <unsigned charactersCount> |
| 81 PassRefPtr<StringImpl> addStaticASCIILiteral( | 81 PassRefPtr<StringImpl> addStaticASCIILiteral( |
| 82 const char (&characters)[charactersCount]) { | 82 const char (&characters)[charactersCount]) { |
| 83 unsigned length = charactersCount - 1; | 83 unsigned length = charactersCount - 1; |
| 84 unsigned hash = StringHasher::computeHashAndMaskTop8Bits( | 84 unsigned hash = StringHasher::computeHashAndMaskTop8Bits( |
| 85 reinterpret_cast<const LChar*>(characters), length); | 85 reinterpret_cast<const LChar*>(characters), length); |
| 86 return adoptRef(StringImpl::createStatic(characters, length, hash)); | 86 return adoptRef(StringImpl::createStatic(characters, length, hash)); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void StringStatics::init() { | 89 void StringStatics::init() { |
| 90 ASSERT(isMainThread()); | 90 DCHECK(isMainThread()); |
| 91 | 91 |
| 92 // FIXME: These should be allocated at compile time. | 92 // FIXME: These should be allocated at compile time. |
| 93 new (NotNull, (void*)&starAtom) AtomicString("*"); | 93 new (NotNull, (void*)&starAtom) AtomicString("*"); |
| 94 new (NotNull, (void*)&xmlAtom) AtomicString(addStaticASCIILiteral("xml")); | 94 new (NotNull, (void*)&xmlAtom) AtomicString(addStaticASCIILiteral("xml")); |
| 95 new (NotNull, (void*)&xmlnsAtom) AtomicString(addStaticASCIILiteral("xmlns")); | 95 new (NotNull, (void*)&xmlnsAtom) AtomicString(addStaticASCIILiteral("xmlns")); |
| 96 new (NotNull, (void*)&xlinkAtom) AtomicString(addStaticASCIILiteral("xlink")); | 96 new (NotNull, (void*)&xlinkAtom) AtomicString(addStaticASCIILiteral("xlink")); |
| 97 new (NotNull, (void*)&xmlnsWithColon) String("xmlns:"); | 97 new (NotNull, (void*)&xmlnsWithColon) String("xmlns:"); |
| 98 new (NotNull, (void*)&httpAtom) AtomicString(addStaticASCIILiteral("http")); | 98 new (NotNull, (void*)&httpAtom) AtomicString(addStaticASCIILiteral("http")); |
| 99 new (NotNull, (void*)&httpsAtom) AtomicString(addStaticASCIILiteral("https")); | 99 new (NotNull, (void*)&httpsAtom) AtomicString(addStaticASCIILiteral("https")); |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace WTF | 102 } // namespace WTF |
| OLD | NEW |