diff options
author | jar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-14 01:51:34 +0000 |
---|---|---|
committer | jar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-14 01:51:34 +0000 |
commit | 71e8a4492241d922f05a57cb86287f389277a243 (patch) | |
tree | c7e74df8aab3f14474598b16403d9049fd7f8a67 /chrome/browser/spellchecker.cc | |
parent | 44cd16fcc85697b5094250a89decaab5c692b392 (diff) | |
download | chromium_src-71e8a4492241d922f05a57cb86287f389277a243.zip chromium_src-71e8a4492241d922f05a57cb86287f389277a243.tar.gz chromium_src-71e8a4492241d922f05a57cb86287f389277a243.tar.bz2 |
Cleanup spell check file to stop using reference counted pointers without need.
I don't really believe this will solve anything (in terms
of the bug), but it did remove some needless complexity
above the crash site in the stack. There is a tiny chance
that there is a shutdown race, where the destruction of the
containing object raced ahead of the execution (and
resulting destruction) of a task. I think the destruction
of the task by the containing object would probably be
bad anyway, and I doubt that it even happens... so this
is all about being cleaner.
bug=1318039
r=brettw
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@850 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/spellchecker.cc')
-rw-r--r-- | chrome/browser/spellchecker.cc | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/chrome/browser/spellchecker.cc b/chrome/browser/spellchecker.cc index 7bea246..bb3cd1a 100644 --- a/chrome/browser/spellchecker.cc +++ b/chrome/browser/spellchecker.cc @@ -28,7 +28,6 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <io.h> -#include <vector> #include "chrome/browser/spellchecker.h" @@ -36,7 +35,6 @@ #include "base/file_util.h" #include "base/histogram.h" #include "base/logging.h" -#include "base/scoped_ptr.h" #include "base/string_util.h" #include "base/thread.h" #include "base/win_util.h" @@ -195,8 +193,8 @@ class UIProxyForIOTask : public Task { if (io_thread) { // io_thread has not been torn down yet. MessageLoop* io_loop = io_thread->message_loop(); if (io_loop) { - scoped_ptr<Task> this_task(spellchecker_flag_set_task_); - io_loop->PostTask(FROM_HERE, this_task.release()); + io_loop->PostTask(FROM_HERE, spellchecker_flag_set_task_); + spellchecker_flag_set_task_ = NULL; } } } @@ -240,9 +238,6 @@ SpellChecker::SpellChecker(const std::wstring& dict_dir, // Remember UI loop to later use this as a proxy to get IO loop. ui_loop_ = MessageLoop::current(); - // Reset dictionary flag setting task to NULL. - dic_task_.reset(NULL); - // Get File Loop - hunspell gets initialized here. Thread* file_thread = g_browser_process->file_thread(); if (file_thread) @@ -295,9 +290,9 @@ bool SpellChecker::Initialize() { bool dic_exists = file_util::PathExists(bdict_file_name_); if (!dic_exists) { if (file_loop_ && !tried_to_download_ && url_request_context_) { - dic_task_.reset(dic_download_state_changer_factory_.NewRunnableMethod( - &SpellChecker::set_file_is_downloading, false)); - ddc_dic_ = new DictionaryDownloadController(dic_task_.release(), + Task* dic_task = dic_download_state_changer_factory_.NewRunnableMethod( + &SpellChecker::set_file_is_downloading, false); + ddc_dic_ = new DictionaryDownloadController(dic_task, bdict_file_name_, url_request_context_, ui_loop_); |