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

Side by Side Diff: chrome/browser/spellcheck_host.cc

Issue 4146004: ThreadRestrictions: disallow blocking IO on the UI thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more Created 10 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/browser/spellcheck_host.h" 5 #include "chrome/browser/spellcheck_host.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/string_split.h" 13 #include "base/string_split.h"
14 #include "base/thread_restrictions.h"
14 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/prefs/pref_member.h" 16 #include "chrome/browser/prefs/pref_member.h"
16 #include "chrome/browser/profile.h" 17 #include "chrome/browser/profile.h"
17 #include "chrome/browser/spellcheck_host_observer.h" 18 #include "chrome/browser/spellcheck_host_observer.h"
18 #include "chrome/browser/spellchecker_platform_engine.h" 19 #include "chrome/browser/spellchecker_platform_engine.h"
19 #include "chrome/common/chrome_constants.h" 20 #include "chrome/common/chrome_constants.h"
20 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
21 #include "chrome/common/net/url_request_context_getter.h" 22 #include "chrome/common/net/url_request_context_getter.h"
22 #include "chrome/common/notification_service.h" 23 #include "chrome/common/notification_service.h"
23 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
24 #include "chrome/common/spellcheck_common.h" 25 #include "chrome/common/spellcheck_common.h"
25 #include "googleurl/src/gurl.h" 26 #include "googleurl/src/gurl.h"
26 27
27 namespace { 28 namespace {
28 29
29 FilePath GetFirstChoiceFilePath(const std::string& language) { 30 FilePath GetFirstChoiceFilePath(const std::string& language) {
30 FilePath dict_dir; 31 FilePath dict_dir;
31 PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir); 32 {
33 // This should not do blocking IO from the UI thread!
34 // Temporarily allow it for now.
35 // http://code.google.com/p/chromium/issues/detail?id=60643
36 base::ThreadRestrictions::ScopedAllowIO allow_io;
37 PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir);
38 }
32 return SpellCheckCommon::GetVersionedFileName(language, dict_dir); 39 return SpellCheckCommon::GetVersionedFileName(language, dict_dir);
33 } 40 }
34 41
35 #if defined(OS_WIN) 42 #if defined(OS_WIN)
36 FilePath GetFallbackFilePath(const FilePath& first_choice) { 43 FilePath GetFallbackFilePath(const FilePath& first_choice) {
37 FilePath dict_dir; 44 FilePath dict_dir;
38 PathService::Get(chrome::DIR_USER_DATA, &dict_dir); 45 PathService::Get(chrome::DIR_USER_DATA, &dict_dir);
39 return dict_dir.Append(first_choice.BaseName()); 46 return dict_dir.Append(first_choice.BaseName());
40 } 47 }
41 #endif 48 #endif
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 309 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
303 NewRunnableMethod(this, 310 NewRunnableMethod(this,
304 &SpellCheckHost::InformObserverOfInitialization)); 311 &SpellCheckHost::InformObserverOfInitialization));
305 return; 312 return;
306 } 313 }
307 } 314 }
308 315
309 data_.clear(); 316 data_.clear();
310 Initialize(); 317 Initialize();
311 } 318 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698