| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2015 Google Inc. All rights reserved. | 3 * Copyright (C) 2015 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 SmallStringKey(WTF::HashTableDeletedValueType) | 64 SmallStringKey(WTF::HashTableDeletedValueType) |
| 65 : length_(kDeletedValueLength), | 65 : length_(kDeletedValueLength), |
| 66 direction_(static_cast<unsigned>(TextDirection::kLtr)) {} | 66 direction_(static_cast<unsigned>(TextDirection::kLtr)) {} |
| 67 | 67 |
| 68 template <typename CharacterType> | 68 template <typename CharacterType> |
| 69 SmallStringKey(CharacterType* characters, | 69 SmallStringKey(CharacterType* characters, |
| 70 unsigned short length, | 70 unsigned short length, |
| 71 TextDirection direction) | 71 TextDirection direction) |
| 72 : length_(length), direction_(static_cast<unsigned>(direction)) { | 72 : length_(length), direction_(static_cast<unsigned>(direction)) { |
| 73 ASSERT(length <= kCapacity); | 73 DCHECK(length <= kCapacity); |
| 74 | 74 |
| 75 StringHasher hasher; | 75 StringHasher hasher; |
| 76 | 76 |
| 77 bool remainder = length & 1; | 77 bool remainder = length & 1; |
| 78 length >>= 1; | 78 length >>= 1; |
| 79 | 79 |
| 80 unsigned i = 0; | 80 unsigned i = 0; |
| 81 while (length--) { | 81 while (length--) { |
| 82 characters_[i] = characters[i]; | 82 characters_[i] = characters[i]; |
| 83 characters_[i + 1] = characters[i + 1]; | 83 characters_[i + 1] = characters[i + 1]; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 inline bool operator==(const ShapeCache::SmallStringKey& a, | 248 inline bool operator==(const ShapeCache::SmallStringKey& a, |
| 249 const ShapeCache::SmallStringKey& b) { | 249 const ShapeCache::SmallStringKey& b) { |
| 250 if (a.length() != b.length() || a.Direction() != b.Direction()) | 250 if (a.length() != b.length() || a.Direction() != b.Direction()) |
| 251 return false; | 251 return false; |
| 252 return WTF::Equal(a.Characters(), b.Characters(), a.length()); | 252 return WTF::Equal(a.Characters(), b.Characters(), a.length()); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace blink | 255 } // namespace blink |
| 256 | 256 |
| 257 #endif // ShapeCache_h | 257 #endif // ShapeCache_h |
| OLD | NEW |