| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/hyphenator/hyphenator.h" | 5 #include "content/renderer/hyphenator/hyphenator.h" |
| 6 | 6 |
| 7 #include "base/files/memory_mapped_file.h" | 7 #include "base/files/memory_mapped_file.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "content/common/hyphenator_messages.h" | 12 #include "content/common/hyphenator_messages.h" |
| 13 #include "content/public/renderer/render_thread.h" | 13 #include "content/public/renderer/render_thread.h" |
| 14 #include "third_party/hyphen/hyphen.h" | 14 #include "third_party/hyphen/hyphen.h" |
| 15 #include "third_party/icu/public/common/unicode/uscript.h" | 15 #include "third_party/icu/source/common/unicode/uscript.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // A class that converts a sequence of UTF-8 characters to UTF-16 ones and holds | 19 // A class that converts a sequence of UTF-8 characters to UTF-16 ones and holds |
| 20 // only the length of converted UTF-16 characters. This class is used for | 20 // only the length of converted UTF-16 characters. This class is used for |
| 21 // creating a mapping from the position of a UTF-8 string to a position of a | 21 // creating a mapping from the position of a UTF-8 string to a position of a |
| 22 // UTF-16 string without unnecessary conversions. Even though the following | 22 // UTF-16 string without unnecessary conversions. Even though the following |
| 23 // snippet produces the same mapping, it needs to convert same characters many | 23 // snippet produces the same mapping, it needs to convert same characters many |
| 24 // times. This class incrementally counts the number of converted UTF-16 | 24 // times. This class incrementally counts the number of converted UTF-16 |
| 25 // characters to avoid this problem. | 25 // characters to avoid this problem. |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 // CanHyphenate function, e.g. WebKit does not have to hyphenate words when it | 261 // CanHyphenate function, e.g. WebKit does not have to hyphenate words when it |
| 262 // does not have to break text into lines.) | 262 // does not have to break text into lines.) |
| 263 if (dictionary_) { | 263 if (dictionary_) { |
| 264 hnj_hyphen_free(dictionary_); | 264 hnj_hyphen_free(dictionary_); |
| 265 dictionary_ = NULL; | 265 dictionary_ = NULL; |
| 266 } | 266 } |
| 267 dictionary_file_.Set(base::FdopenPlatformFile(rule_file, "r")); | 267 dictionary_file_.Set(base::FdopenPlatformFile(rule_file, "r")); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace content | 270 } // namespace content |
| OLD | NEW |