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/file_util.h" | 7 #include "base/file_util.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/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/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 "unicode/uscript.h" | 15 #include "third_party/icu/public/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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // does not have to break text into lines.) | 271 // does not have to break text into lines.) |
272 if (dictionary_) { | 272 if (dictionary_) { |
273 hnj_hyphen_free(dictionary_); | 273 hnj_hyphen_free(dictionary_); |
274 dictionary_ = NULL; | 274 dictionary_ = NULL; |
275 } | 275 } |
276 rule_map_.reset(); | 276 rule_map_.reset(); |
277 rule_file_ = rule_file; | 277 rule_file_ = rule_file; |
278 } | 278 } |
279 | 279 |
280 } // namespace content | 280 } // namespace content |
OLD | NEW |