OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/fonts/opentype/FontSettings.h" | 5 #include "platform/fonts/opentype/FontSettings.h" |
6 | 6 |
7 #include "wtf/HashFunctions.h" | 7 #include "platform/wtf/HashFunctions.h" |
8 #include "wtf/StringHasher.h" | 8 #include "platform/wtf/StringHasher.h" |
9 #include "wtf/text/AtomicStringHash.h" | 9 #include "platform/wtf/text/AtomicStringHash.h" |
10 #include "wtf/text/StringHash.h" | 10 #include "platform/wtf/text/StringHash.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 uint32_t atomicStringToFourByteTag(AtomicString tag) { | 14 uint32_t atomicStringToFourByteTag(AtomicString tag) { |
15 DCHECK_EQ(tag.length(), 4u); | 15 DCHECK_EQ(tag.length(), 4u); |
16 return (((tag[0]) << 24) | ((tag[1]) << 16) | ((tag[2]) << 8) | (tag[3])); | 16 return (((tag[0]) << 24) | ((tag[1]) << 16) | ((tag[2]) << 8) | (tag[3])); |
17 } | 17 } |
18 | 18 |
19 static inline void addToHash(unsigned& hash, unsigned key) { | 19 static inline void addToHash(unsigned& hash, unsigned key) { |
20 hash = ((hash << 5) + hash) + key; // Djb2 | 20 hash = ((hash << 5) + hash) + key; // Djb2 |
(...skipping 12 matching lines...) Expand all Loading... |
33 for (unsigned j = 0; j < tag.length(); j++) { | 33 for (unsigned j = 0; j < tag.length(); j++) { |
34 stringHasher.addCharacter(tag[j]); | 34 stringHasher.addCharacter(tag[j]); |
35 } | 35 } |
36 addToHash(computedHash, stringHasher.hash()); | 36 addToHash(computedHash, stringHasher.hash()); |
37 addFloatToHash(computedHash, at(i).value()); | 37 addFloatToHash(computedHash, at(i).value()); |
38 } | 38 } |
39 return computedHash; | 39 return computedHash; |
40 } | 40 } |
41 | 41 |
42 } // namespace blink | 42 } // namespace blink |
OLD | NEW |