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

Unified Diff: chrome/browser/spellchecker/spellcheck_host_impl.cc

Issue 7919003: Remove refptr usages from SpellCheckHost (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 3 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
Index: chrome/browser/spellchecker/spellcheck_host_impl.cc
diff --git a/chrome/browser/spellchecker/spellcheck_host_impl.cc b/chrome/browser/spellchecker/spellcheck_host_impl.cc
index c49af7e260b7dfd3e2acf8c6dadd95c67706e4a6..f4cf5c2c9a90ade794ab7ee31c0f5477f7eca3fb 100644
--- a/chrome/browser/spellchecker/spellcheck_host_impl.cc
+++ b/chrome/browser/spellchecker/spellcheck_host_impl.cc
@@ -90,7 +90,8 @@ SpellCheckHostImpl::SpellCheckHostImpl(
tried_to_download_(false),
use_platform_spellchecker_(false),
request_context_getter_(request_context_getter),
- metrics_(metrics) {
+ metrics_(metrics),
+ ALLOW_THIS_IN_INITIALIZER_LIST(service_task_factory_(this)) {
DCHECK(profile_);
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -117,7 +118,7 @@ void SpellCheckHostImpl::Initialize() {
use_platform_spellchecker_ = true;
SpellCheckerPlatform::SetLanguage(language_);
MessageLoop::current()->PostTask(FROM_HERE,
- NewRunnableMethod(this,
+ service_task_factory_.NewRunnableMethod(
&SpellCheckHostImpl::InformProfileOfInitialization));
return;
}
@@ -127,7 +128,7 @@ void SpellCheckHostImpl::Initialize() {
#endif
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
- NewRunnableMethod(this,
+ service_task_factory_.NewRunnableMethod(
&SpellCheckHostImpl::InitializeDictionaryLocation));
}
@@ -174,7 +175,7 @@ void SpellCheckHostImpl::AddWord(const std::string& word) {
if (profile_)
profile_->CustomWordAddedLocally(word);
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
- NewRunnableMethod(this,
+ service_task_factory_.NewRunnableMethod(
&SpellCheckHostImpl::WriteWordToCustomDictionary, word));
for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
!i.IsAtEnd(); i.Advance()) {
@@ -230,7 +231,8 @@ void SpellCheckHostImpl::InitializeInternal() {
// We download from the ui thread because we need to know that
// |request_context_getter_| is still valid before initiating the download.
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(this, &SpellCheckHostImpl::DownloadDictionary));
+ service_task_factory_.NewRunnableMethod(
+ &SpellCheckHostImpl::DownloadDictionary));
return;
}
@@ -248,8 +250,7 @@ void SpellCheckHostImpl::InitializeInternal() {
}
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(
- this,
+ service_task_factory_.NewRunnableMethod(
&SpellCheckHostImpl::InformProfileOfInitializationWithCustomWords,
custom_words.release()));
}
@@ -258,7 +259,8 @@ void SpellCheckHostImpl::InitializeOnFileThread() {
DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::FILE));
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
- NewRunnableMethod(this, &SpellCheckHostImpl::Initialize));
+ service_task_factory_.NewRunnableMethod(
+ &SpellCheckHostImpl::Initialize));
}
void SpellCheckHostImpl::InformProfileOfInitialization() {
@@ -348,7 +350,8 @@ void SpellCheckHostImpl::OnURLFetchComplete(const URLFetcher* source,
data_ = data;
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
- NewRunnableMethod(this, &SpellCheckHostImpl::SaveDictionaryData));
+ service_task_factory_.NewRunnableMethod(
+ &SpellCheckHostImpl::SaveDictionaryData));
}
void SpellCheckHostImpl::Observe(int type,
@@ -370,7 +373,7 @@ void SpellCheckHostImpl::SaveDictionaryData() {
if (!verified) {
LOG(ERROR) << "Failure to verify the downloaded dictionary.";
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(this,
+ service_task_factory_.NewRunnableMethod(
&SpellCheckHostImpl::InformProfileOfInitialization));
return;
}
@@ -395,7 +398,7 @@ void SpellCheckHostImpl::SaveDictionaryData() {
// To avoid trying to load a partially saved dictionary, shortcut the
// Initialize() call.
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(this,
+ service_task_factory_.NewRunnableMethod(
&SpellCheckHostImpl::InformProfileOfInitialization));
return;
}

Powered by Google App Engine
This is Rietveld 408576698