diff options
author | lipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-02 21:44:10 +0000 |
---|---|---|
committer | lipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-02 21:44:10 +0000 |
commit | c859d92cdc52a46a9df92ea91fc0619c45f98be3 (patch) | |
tree | 043efa276ad4ad815ce1f628f5509f67e0453025 /chrome | |
parent | a82a892e28f848a68e1f1a2bbc6a451e43c8025c (diff) | |
download | chromium_src-c859d92cdc52a46a9df92ea91fc0619c45f98be3.zip chromium_src-c859d92cdc52a46a9df92ea91fc0619c45f98be3.tar.gz chromium_src-c859d92cdc52a46a9df92ea91fc0619c45f98be3.tar.bz2 |
Revert 83792 - Add DCHECKS to ensure syncer thread methods are called from the right thread.
BUG=
TEST=
Review URL: http://codereview.chromium.org/6898035
TBR=lipalani@chromium.org
Review URL: http://codereview.chromium.org/6907005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83798 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/sync/engine/syncer_thread.cc | 16 | ||||
-rw-r--r-- | chrome/browser/sync/engine/syncer_thread.h | 5 |
2 files changed, 3 insertions, 18 deletions
diff --git a/chrome/browser/sync/engine/syncer_thread.cc b/chrome/browser/sync/engine/syncer_thread.cc index d48ded0..dda78a1 100644 --- a/chrome/browser/sync/engine/syncer_thread.cc +++ b/chrome/browser/sync/engine/syncer_thread.cc @@ -76,8 +76,7 @@ SyncerThread::SyncerThread(sessions::SyncSessionContext* context, server_connection_ok_(false), delay_provider_(new DelayProvider()), syncer_(syncer), - session_context_(context), - created_on_loop_(MessageLoop::current()) { + session_context_(context) { } SyncerThread::~SyncerThread() { @@ -87,8 +86,6 @@ SyncerThread::~SyncerThread() { void SyncerThread::CheckServerConnectionManagerStatus( HttpResponse::ServerConnectionCode code) { - DCHECK_EQ(MessageLoop::current(), thread_.message_loop()); - VLOG(1) << "SyncerThread(" << this << ")" << " Server connection changed." << "Old mode: " << server_connection_ok_ << " Code: " << code; // Note, be careful when adding cases here because if the SyncerThread @@ -113,7 +110,6 @@ void SyncerThread::CheckServerConnectionManagerStatus( void SyncerThread::Start(Mode mode, ModeChangeCallback* callback) { VLOG(1) << "SyncerThread(" << this << ")" << " Start called from thread " << MessageLoop::current()->thread_name(); - DCHECK_EQ(MessageLoop::current(), created_on_loop_); if (!thread_.IsRunning()) { VLOG(1) << "SyncerThread(" << this << ")" << " Starting thread with mode " << mode; @@ -146,9 +142,7 @@ void SyncerThread::SendInitialSnapshot() { void SyncerThread::WatchConnectionManager() { ServerConnectionManager* scm = session_context_->connection_manager(); - thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, - &SyncerThread::CheckServerConnectionManagerStatus, - scm->server_status())); + CheckServerConnectionManagerStatus(scm->server_status()); scm->AddListener(this); } @@ -276,7 +270,6 @@ bool SyncerThread::ShouldRunJob(const SyncSessionJob& job) { } void SyncerThread::SaveJob(const SyncSessionJob& job) { - DCHECK_EQ(MessageLoop::current(), thread_.message_loop()); DCHECK(job.purpose != SyncSessionJob::CLEAR_USER_DATA); if (job.purpose == SyncSessionJob::NUDGE) { VLOG(1) << "SyncerThread(" << this << ")" << " Saving a nudge job"; @@ -305,7 +298,6 @@ struct ModelSafeWorkerGroupIs { }; void SyncerThread::ScheduleClearUserData() { - DCHECK_EQ(MessageLoop::current(), created_on_loop_); if (!thread_.IsRunning()) { NOTREACHED(); return; @@ -317,7 +309,6 @@ void SyncerThread::ScheduleClearUserData() { void SyncerThread::ScheduleNudge(const TimeDelta& delay, NudgeSource source, const ModelTypeBitSet& types, const tracked_objects::Location& nudge_location) { - DCHECK_EQ(MessageLoop::current(), created_on_loop_); if (!thread_.IsRunning()) { NOTREACHED(); return; @@ -336,7 +327,6 @@ void SyncerThread::ScheduleNudge(const TimeDelta& delay, void SyncerThread::ScheduleNudgeWithPayloads(const TimeDelta& delay, NudgeSource source, const ModelTypePayloadMap& types_with_payloads, const tracked_objects::Location& nudge_location) { - DCHECK_EQ(MessageLoop::current(), created_on_loop_); if (!thread_.IsRunning()) { NOTREACHED(); return; @@ -455,7 +445,6 @@ void GetModelSafeParamsForTypes(const ModelTypeBitSet& types, } void SyncerThread::ScheduleConfig(const ModelTypeBitSet& types) { - DCHECK_EQ(MessageLoop::current(), created_on_loop_); if (!thread_.IsRunning()) { NOTREACHED(); return; @@ -683,6 +672,7 @@ void SyncerThread::ScheduleNextSync(const SyncSessionJob& old_job) { void SyncerThread::AdjustPolling(const SyncSessionJob* old_job) { DCHECK(thread_.IsRunning()); DCHECK_EQ(MessageLoop::current(), thread_.message_loop()); + TimeDelta poll = (!session_context_->notifications_enabled()) ? syncer_short_poll_interval_seconds_ : syncer_long_poll_interval_seconds_; diff --git a/chrome/browser/sync/engine/syncer_thread.h b/chrome/browser/sync/engine/syncer_thread.h index ba13b0d..8ed1040 100644 --- a/chrome/browser/sync/engine/syncer_thread.h +++ b/chrome/browser/sync/engine/syncer_thread.h @@ -328,11 +328,6 @@ class SyncerThread : public sessions::SyncSession::Delegate, scoped_ptr<sessions::SyncSessionContext> session_context_; - // A cache of the thread message loop that created this object. This is used - // to perform a DCHECK to ensure the public APIs are called from only from the - // same single thread. - MessageLoop* const created_on_loop_; - DISALLOW_COPY_AND_ASSIGN(SyncerThread); }; |