| 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 #ifndef CONTENT_RENDERER_HYPHENATOR_HYPHENATOR_H_ | 5 #ifndef CONTENT_RENDERER_HYPHENATOR_HYPHENATOR_H_ |
| 6 #define CONTENT_RENDERER_HYPHENATOR_HYPHENATOR_H_ | 6 #define CONTENT_RENDERER_HYPHENATOR_HYPHENATOR_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/public/renderer/render_process_observer.h" | 14 #include "content/public/renderer/render_process_observer.h" |
| 15 #include "ipc/ipc_platform_file.h" | 15 #include "ipc/ipc_platform_file.h" |
| 16 | 16 |
| 17 namespace file_util { | 17 namespace base { |
| 18 class MemoryMappedFile; | 18 class MemoryMappedFile; |
| 19 } | 19 } |
| 20 | 20 |
| 21 typedef struct _HyphenDict HyphenDict; | 21 typedef struct _HyphenDict HyphenDict; |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 class RenderThread; | 24 class RenderThread; |
| 25 | 25 |
| 26 // A class that hyphenates a word. This class encapsulates the hyphen library | 26 // A class that hyphenates a word. This class encapsulates the hyphen library |
| 27 // and manages resources used by the library. When this class uses a huge | 27 // and manages resources used by the library. When this class uses a huge |
| (...skipping 28 matching lines...) Expand all Loading... |
| 56 void OnSetDictionary(IPC::PlatformFileForTransit rule_file); | 56 void OnSetDictionary(IPC::PlatformFileForTransit rule_file); |
| 57 | 57 |
| 58 // The dictionary used by the hyphen library. | 58 // The dictionary used by the hyphen library. |
| 59 HyphenDict* dictionary_; | 59 HyphenDict* dictionary_; |
| 60 | 60 |
| 61 // The dictionary file and its memory-mapping object. (Our copy of the hyphen | 61 // The dictionary file and its memory-mapping object. (Our copy of the hyphen |
| 62 // library uses a memory-mapped file opened by a browser so renderers can use | 62 // library uses a memory-mapped file opened by a browser so renderers can use |
| 63 // it without opening the file.) | 63 // it without opening the file.) |
| 64 string16 locale_; | 64 string16 locale_; |
| 65 base::PlatformFile rule_file_; | 65 base::PlatformFile rule_file_; |
| 66 scoped_ptr<file_util::MemoryMappedFile> rule_map_; | 66 scoped_ptr<base::MemoryMappedFile> rule_map_; |
| 67 | 67 |
| 68 // A cached result. WebKit often calls ComputeLastHyphenLocation with the same | 68 // A cached result. WebKit often calls ComputeLastHyphenLocation with the same |
| 69 // word multiple times to find the best hyphenation point when it finds a line | 69 // word multiple times to find the best hyphenation point when it finds a line |
| 70 // break. On the other hand, the hyphen library returns all hyphenation points | 70 // break. On the other hand, the hyphen library returns all hyphenation points |
| 71 // for a word. This class caches the hyphenation points returned by the hyphen | 71 // for a word. This class caches the hyphenation points returned by the hyphen |
| 72 // library to avoid calling the library multiple times. | 72 // library to avoid calling the library multiple times. |
| 73 string16 word_; | 73 string16 word_; |
| 74 bool result_; | 74 bool result_; |
| 75 std::vector<int> hyphen_offsets_; | 75 std::vector<int> hyphen_offsets_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(Hyphenator); | 77 DISALLOW_COPY_AND_ASSIGN(Hyphenator); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace content | 80 } // namespace content |
| 81 | 81 |
| 82 #endif // CONTENT_RENDERER_HYPHENATOR_HYPHENATOR_H_ | 82 #endif // CONTENT_RENDERER_HYPHENATOR_HYPHENATOR_H_ |
| OLD | NEW |