| 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/text/Hyphenation.h" | 5 #include "platform/text/Hyphenation.h" |
| 6 | 6 |
| 7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
| 8 #include "base/files/memory_mapped_file.h" | 8 #include "base/files/memory_mapped_file.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/timer/elapsed_timer.h" | 10 #include "base/timer/elapsed_timer.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 bool HyphenationMinikin::openDictionary(const AtomicString& locale) { | 60 bool HyphenationMinikin::openDictionary(const AtomicString& locale) { |
| 61 base::File file = openDictionaryFile(locale); | 61 base::File file = openDictionaryFile(locale); |
| 62 if (!file.IsValid()) | 62 if (!file.IsValid()) |
| 63 return false; | 63 return false; |
| 64 if (!m_file.Initialize(std::move(file))) { | 64 if (!m_file.Initialize(std::move(file))) { |
| 65 DLOG(ERROR) << "mmap failed"; | 65 DLOG(ERROR) << "mmap failed"; |
| 66 return false; | 66 return false; |
| 67 } | 67 } |
| 68 | 68 |
| 69 m_hyphenator = wrapUnique(Hyphenator::loadBinary(m_file.data())); | 69 m_hyphenator = WTF::wrapUnique(Hyphenator::loadBinary(m_file.data())); |
| 70 | 70 |
| 71 return true; | 71 return true; |
| 72 } | 72 } |
| 73 | 73 |
| 74 std::vector<uint8_t> HyphenationMinikin::hyphenate( | 74 std::vector<uint8_t> HyphenationMinikin::hyphenate( |
| 75 const StringView& text) const { | 75 const StringView& text) const { |
| 76 std::vector<uint8_t> result; | 76 std::vector<uint8_t> result; |
| 77 if (text.is8Bit()) { | 77 if (text.is8Bit()) { |
| 78 String text16Bit = text.toString(); | 78 String text16Bit = text.toString(); |
| 79 text16Bit.ensure16Bit(); | 79 text16Bit.ensure16Bit(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 DEFINE_STATIC_LOCAL(LocaleMap, localeFallback, (createLocaleFallbackMap())); | 165 DEFINE_STATIC_LOCAL(LocaleMap, localeFallback, (createLocaleFallbackMap())); |
| 166 const auto& it = localeFallback.find(locale); | 166 const auto& it = localeFallback.find(locale); |
| 167 if (it != localeFallback.end()) | 167 if (it != localeFallback.end()) |
| 168 return LayoutLocale::get(it->value)->getHyphenation(); | 168 return LayoutLocale::get(it->value)->getHyphenation(); |
| 169 | 169 |
| 170 return nullptr; | 170 return nullptr; |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace blink | 173 } // namespace blink |
| OLD | NEW |