| 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;
|
| }
|
|
|