| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 static const bool hasIsEmptyValueFunction = true; | 128 static const bool hasIsEmptyValueFunction = true; |
| 129 static bool isEmptyValue(const SmallStringKey& key) { return key.isHashT
ableEmptyValue(); } | 129 static bool isEmptyValue(const SmallStringKey& key) { return key.isHashT
ableEmptyValue(); } |
| 130 static const unsigned minimumTableSize = 16; | 130 static const unsigned minimumTableSize = 16; |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 friend bool operator==(const SmallStringKey&, const SmallStringKey&); | 133 friend bool operator==(const SmallStringKey&, const SmallStringKey&); |
| 134 | 134 |
| 135 public: | 135 public: |
| 136 ShapeCache(): m_weakFactory(this), m_version(0) { } | 136 ShapeCache(): m_weakFactory(this), m_version(0) { } |
| 137 | 137 |
| 138 static unsigned maxLengthToCache() { return SmallStringKey::capacity(); } |
| 139 |
| 138 ShapeCacheEntry* add(const TextRun& run, ShapeCacheEntry entry) | 140 ShapeCacheEntry* add(const TextRun& run, ShapeCacheEntry entry) |
| 139 { | 141 { |
| 140 if (static_cast<unsigned>(run.length()) > SmallStringKey::capacity()) | 142 if (static_cast<unsigned>(run.length()) > SmallStringKey::capacity()) |
| 141 return 0; | 143 return 0; |
| 142 | 144 |
| 143 return addSlowCase(run, entry); | 145 return addSlowCase(run, entry); |
| 144 } | 146 } |
| 145 | 147 |
| 146 void clearIfVersionChanged(unsigned version) | 148 void clearIfVersionChanged(unsigned version) |
| 147 { | 149 { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 inline bool operator==(const ShapeCache::SmallStringKey& a, const ShapeCache::Sm
allStringKey& b) | 242 inline bool operator==(const ShapeCache::SmallStringKey& a, const ShapeCache::Sm
allStringKey& b) |
| 241 { | 243 { |
| 242 if (a.length() != b.length() || a.direction() != b.direction()) | 244 if (a.length() != b.length() || a.direction() != b.direction()) |
| 243 return false; | 245 return false; |
| 244 return WTF::equal(a.characters(), b.characters(), a.length()); | 246 return WTF::equal(a.characters(), b.characters(), a.length()); |
| 245 } | 247 } |
| 246 | 248 |
| 247 } // namespace blink | 249 } // namespace blink |
| 248 | 250 |
| 249 #endif // ShapeCache_h | 251 #endif // ShapeCache_h |
| OLD | NEW |