diff options
author | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-15 08:29:52 +0000 |
---|---|---|
committer | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-15 08:29:52 +0000 |
commit | 7139164a7d96ed03f2c74313fc56f894348913d4 (patch) | |
tree | 8c971669561f4e8612ed35ab0ad96efc51b127f5 | |
parent | ba4ad0eeaa410d421066ba5b5df03011548f9f51 (diff) | |
download | chromium_src-7139164a7d96ed03f2c74313fc56f894348913d4.zip chromium_src-7139164a7d96ed03f2c74313fc56f894348913d4.tar.gz chromium_src-7139164a7d96ed03f2c74313fc56f894348913d4.tar.bz2 |
A quick fix for Bug 60643.
This change just moves the initialization code of |bdict_file_path_| from SpellCheckHostImpl::SpellCheckHostImpl() (running on the UI thread) to SpellCheckHostImpl::InitializeDictionaryLocation() (running on the FILE thread) so we can initialize it without assertions.
BUG=60643
TEST=Run Chrome without crashes.
Review URL: http://codereview.chromium.org/6646042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78176 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/spellcheck_host_impl.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/chrome/browser/spellcheck_host_impl.cc b/chrome/browser/spellcheck_host_impl.cc index 79a07c1..cdaaf17 100644 --- a/chrome/browser/spellcheck_host_impl.cc +++ b/chrome/browser/spellcheck_host_impl.cc @@ -29,14 +29,10 @@ namespace { FilePath GetFirstChoiceFilePath(const std::string& language) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); + FilePath dict_dir; - { - // This should not do blocking IO from the UI thread! - // Temporarily allow it for now. - // http://code.google.com/p/chromium/issues/detail?id=60643 - base::ThreadRestrictions::ScopedAllowIO allow_io; - PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir); - } + PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir); return SpellCheckCommon::GetVersionedFileName(language, dict_dir); } @@ -94,8 +90,6 @@ SpellCheckHostImpl::SpellCheckHostImpl( PathService::Get(chrome::DIR_USER_DATA, &personal_file_directory); custom_dictionary_file_ = personal_file_directory.Append(chrome::kCustomDictionaryFileName); - - bdict_file_path_ = GetFirstChoiceFilePath(language); } SpellCheckHostImpl::~SpellCheckHostImpl() { @@ -149,6 +143,11 @@ void SpellCheckHostImpl::AddWord(const std::string& word) { void SpellCheckHostImpl::InitializeDictionaryLocation() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); + // Initialize the BDICT path. This initialization should be in the FILE thread + // because it checks if there is a "Dictionaries" directory and create it. + if (bdict_file_path_.empty()) + bdict_file_path_ = GetFirstChoiceFilePath(language_); + #if defined(OS_WIN) // Check if the dictionary exists in the fallback location. If so, use it // rather than downloading anew. |