diff options
author | chron@chromium.org <chron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-26 05:14:49 +0000 |
---|---|---|
committer | chron@chromium.org <chron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-26 05:14:49 +0000 |
commit | 95f13aded2acdad583acfa38139a54780945c46a (patch) | |
tree | 3c3cf287174d9217b169764be14138b22b86bff4 /chrome | |
parent | d2360a5e34b37a76545d083dd977368035b930c6 (diff) | |
download | chromium_src-95f13aded2acdad583acfa38139a54780945c46a.zip chromium_src-95f13aded2acdad583acfa38139a54780945c46a.tar.gz chromium_src-95f13aded2acdad583acfa38139a54780945c46a.tar.bz2 |
Use message loop proxy to avoid null message loop crashes.
BUG=49275
TEST=Make a lot of bookmarks. Delete a huge batch and quickly close the browser.
Review URL: http://codereview.chromium.org/2868066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53611 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/sync/engine/auth_watcher.cc | 11 | ||||
-rw-r--r-- | chrome/browser/sync/engine/auth_watcher.h | 6 |
2 files changed, 12 insertions, 5 deletions
diff --git a/chrome/browser/sync/engine/auth_watcher.cc b/chrome/browser/sync/engine/auth_watcher.cc index 46b3852..b414e18 100644 --- a/chrome/browser/sync/engine/auth_watcher.cc +++ b/chrome/browser/sync/engine/auth_watcher.cc @@ -56,6 +56,7 @@ AuthWatcher::AuthWatcher(DirectoryManager* dirman, NOTREACHED() << "Couldn't start SyncEngine_AuthWatcherThread"; gaia_->set_message_loop(message_loop()); + loop_proxy_ = auth_backend_thread_.message_loop_proxy(); connmgr_hookup_.reset( NewEventListenerHookup(scm->channel(), this, @@ -85,7 +86,7 @@ void AuthWatcher::PersistCredentials() { // TODO(chron): Full integration test suite needed. http://crbug.com/35429 void AuthWatcher::RenewAuthToken(const std::string& updated_token) { - message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, + message_loop_proxy()->PostTask(FROM_HERE, NewRunnableMethod(this, &AuthWatcher::DoRenewAuthToken, updated_token)); } @@ -106,7 +107,7 @@ void AuthWatcher::DoRenewAuthToken(const std::string& updated_token) { } void AuthWatcher::AuthenticateWithLsid(const std::string& lsid) { - message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, + message_loop_proxy()->PostTask(FROM_HERE, NewRunnableMethod(this, &AuthWatcher::DoAuthenticateWithLsid, lsid)); } @@ -128,7 +129,7 @@ const char kAuthWatcher[] = "AuthWatcher"; void AuthWatcher::AuthenticateWithToken(const std::string& gaia_email, const std::string& auth_token) { - message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, + message_loop_proxy()->PostTask(FROM_HERE, NewRunnableMethod(this, &AuthWatcher::DoAuthenticateWithToken, gaia_email, auth_token)); } @@ -283,7 +284,7 @@ void AuthWatcher::NotifyAuthChanged(const string& email, void AuthWatcher::HandleServerConnectionEvent( const ServerConnectionEvent& event) { - message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, + message_loop_proxy()->PostTask(FROM_HERE, NewRunnableMethod(this, &AuthWatcher::DoHandleServerConnectionEvent, event, scm_->auth_token())); } @@ -330,7 +331,7 @@ void AuthWatcher::Authenticate(const string& email, const string& password, AuthRequest request = { FormatAsEmailAddress(email), password, empty, captcha_token, captcha_value, AuthWatcherEvent::USER_INITIATED }; - message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, + message_loop_proxy()->PostTask(FROM_HERE, NewRunnableMethod(this, &AuthWatcher::DoAuthenticate, request)); } diff --git a/chrome/browser/sync/engine/auth_watcher.h b/chrome/browser/sync/engine/auth_watcher.h index acce5b9..80fd662 100644 --- a/chrome/browser/sync/engine/auth_watcher.h +++ b/chrome/browser/sync/engine/auth_watcher.h @@ -13,6 +13,7 @@ #include "base/atomicops.h" #include "base/gtest_prod_util.h" +#include "base/message_loop_proxy.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/thread.h" @@ -148,6 +149,10 @@ class AuthWatcher : public base::RefCountedThreadSafe<AuthWatcher> { MessageLoop* message_loop() { return auth_backend_thread_.message_loop(); } + base::MessageLoopProxy* message_loop_proxy() { + return loop_proxy_; + } + void DoRenewAuthToken(const std::string& updated_token); // These two helpers should only be called from the auth function. @@ -208,6 +213,7 @@ class AuthWatcher : public base::RefCountedThreadSafe<AuthWatcher> { scoped_ptr<Channel> channel_; base::Thread auth_backend_thread_; + scoped_refptr<base::MessageLoopProxy> loop_proxy_; AuthWatcherEvent::AuthenticationTrigger current_attempt_trigger_; DISALLOW_COPY_AND_ASSIGN(AuthWatcher); |