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