Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1237)

Unified Diff: content/renderer/hyphenator/hyphenator.cc

Issue 12259025: Linux: apply a different hyphen patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/hyphenator/hyphenator.h ('k') | third_party/hyphen/README.chromium » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/hyphenator/hyphenator.cc
diff --git a/content/renderer/hyphenator/hyphenator.cc b/content/renderer/hyphenator/hyphenator.cc
index 163f4c114c9050acbca38681b41d8e143422442a..ae60fd8e41704ec56f74102608d356bf8063a026 100644
--- a/content/renderer/hyphenator/hyphenator.cc
+++ b/content/renderer/hyphenator/hyphenator.cc
@@ -184,31 +184,22 @@ namespace content {
Hyphenator::Hyphenator(base::PlatformFile file)
: dictionary_(NULL),
- rule_file_(file),
+ dictionary_file_(base::FdopenPlatformFile(file, "r")),
result_(0) {
}
Hyphenator::~Hyphenator() {
if (dictionary_)
hnj_hyphen_free(dictionary_);
- if (rule_file_ != base::kInvalidPlatformFileValue)
- base::ClosePlatformFile(rule_file_);
}
bool Hyphenator::Initialize() {
if (dictionary_)
return true;
- // Attach the dictionary file to the MemoryMappedFile object. When it
- // succeeds, this class does not have to close this file because it is closed
- // by the MemoryMappedFile class. To prevent this class from closing this
- // file, we reset its handle.
- rule_map_.reset(new base::MemoryMappedFile);
- if (!rule_map_->Initialize(rule_file_))
+ if (!dictionary_file_.get())
return false;
- rule_file_ = base::kInvalidPlatformFileValue;
-
- dictionary_ = hnj_hyphen_load(rule_map_->data(), rule_map_->length());
+ dictionary_ = hnj_hyphen_load_file(dictionary_file_.get());
return !!dictionary_;
}
@@ -273,8 +264,7 @@ void Hyphenator::OnSetDictionary(IPC::PlatformFileForTransit file) {
hnj_hyphen_free(dictionary_);
dictionary_ = NULL;
}
- rule_map_.reset();
- rule_file_ = rule_file;
+ dictionary_file_.Set(base::FdopenPlatformFile(rule_file, "r"));
}
} // namespace content
« no previous file with comments | « content/renderer/hyphenator/hyphenator.h ('k') | third_party/hyphen/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698