diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-16 22:55:17 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-16 22:55:17 +0000 |
commit | cb6037d67847a6341eea166baf1d4051667a0b88 (patch) | |
tree | 2b766762057e96d758385b96e2a576d7b6690d54 /chrome/renderer/spellchecker | |
parent | f9be34d622561d5599603b41d1c43d595e503426 (diff) | |
download | chromium_src-cb6037d67847a6341eea166baf1d4051667a0b88.zip chromium_src-cb6037d67847a6341eea166baf1d4051667a0b88.tar.gz chromium_src-cb6037d67847a6341eea166baf1d4051667a0b88.tar.bz2 |
reland 31875. Revert was:
------
Revert 31875 to see whether it fixes reliability bot.
BUG=25677
TEST=None
------
TBR=huanr
Review URL: http://codereview.chromium.org/397017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/spellchecker')
-rw-r--r-- | chrome/renderer/spellchecker/spellcheck.cc | 14 | ||||
-rw-r--r-- | chrome/renderer/spellchecker/spellcheck.h | 10 |
2 files changed, 11 insertions, 13 deletions
diff --git a/chrome/renderer/spellchecker/spellcheck.cc b/chrome/renderer/spellchecker/spellcheck.cc index a565b08..3b02b54 100644 --- a/chrome/renderer/spellchecker/spellcheck.cc +++ b/chrome/renderer/spellchecker/spellcheck.cc @@ -16,7 +16,8 @@ static const int kMaxSuggestions = 5; using base::TimeTicks; SpellCheck::SpellCheck() - : auto_spell_correct_turned_on_(false), + : file_(base::kInvalidPlatformFileValue), + auto_spell_correct_turned_on_(false), // TODO(estade): initialize this properly. is_using_platform_spelling_engine_(false), initialized_(false) { @@ -26,13 +27,13 @@ SpellCheck::SpellCheck() SpellCheck::~SpellCheck() { } -void SpellCheck::Init(const base::FileDescriptor& fd, +void SpellCheck::Init(base::PlatformFile file, const std::vector<std::string>& custom_words, const std::string language) { initialized_ = true; hunspell_.reset(); bdict_file_.reset(); - fd_ = fd; + file_ = file; character_attributes_.SetDefaultLanguage(language); custom_words_.insert(custom_words_.end(), @@ -57,7 +58,7 @@ bool SpellCheck::SpellCheckWord( return true; // Do nothing if spell checking is disabled. - if (initialized_ && fd_.fd == -1) + if (initialized_ && file_ == base::kInvalidPlatformFileValue) return true; *misspelling_start = 0; @@ -164,7 +165,7 @@ void SpellCheck::InitializeHunspell() { bdict_file_.reset(new file_util::MemoryMappedFile); - if (bdict_file_->Initialize(fd_)) { + if (bdict_file_->Initialize(file_)) { TimeTicks start_time = TimeTicks::Now(); hunspell_.reset( @@ -194,7 +195,8 @@ bool SpellCheck::InitializeIfNeeded() { } // Check if the platform spellchecker is being used. - if (!is_using_platform_spelling_engine_ && fd_.fd != -1) { + if (!is_using_platform_spelling_engine_ && + file_ != base::kInvalidPlatformFileValue) { // If it isn't, init hunspell. InitializeHunspell(); } diff --git a/chrome/renderer/spellchecker/spellcheck.h b/chrome/renderer/spellchecker/spellcheck.h index b482770..ef194bd 100644 --- a/chrome/renderer/spellchecker/spellcheck.h +++ b/chrome/renderer/spellchecker/spellcheck.h @@ -10,7 +10,7 @@ #include <vector> #include "app/l10n_util.h" -#include "base/file_descriptor_posix.h" +#include "base/platform_file.h" #include "base/string16.h" #include "base/time.h" #include "chrome/renderer/spellchecker/spellcheck_worditerator.h" @@ -18,10 +18,6 @@ class Hunspell; -namespace base { -class FileDescriptor; -} - namespace file_util { class MemoryMappedFile; } @@ -32,7 +28,7 @@ class SpellCheck { ~SpellCheck(); - void Init(const base::FileDescriptor& bdict_fd, + void Init(base::PlatformFile file, const std::vector<std::string>& custom_words, const std::string language); @@ -101,7 +97,7 @@ class SpellCheck { // The hunspell dictionary in use. scoped_ptr<Hunspell> hunspell_; - base::FileDescriptor fd_; + base::PlatformFile file_; std::vector<std::string> custom_words_; // Represents character attributes used for filtering out characters which |