diff options
author | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-18 18:38:05 +0000 |
---|---|---|
committer | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-18 18:38:05 +0000 |
commit | 97df7222afa347b1cbdbebe01e325159ff4e3203 (patch) | |
tree | a775425387884f7ad81a21d723655789ee27c87b /sync | |
parent | f6b321a99425da74477cde01134aa959796663b6 (diff) | |
download | chromium_src-97df7222afa347b1cbdbebe01e325159ff4e3203.zip chromium_src-97df7222afa347b1cbdbebe01e325159ff4e3203.tar.gz chromium_src-97df7222afa347b1cbdbebe01e325159ff4e3203.tar.bz2 |
sync: Remove SyncSessionJob destruction observer
This code was used to track down crbug.com/165561. It hasn't detected
any crashes since M26 was branched. It's safe to remove it now.
BUG=165561
Review URL: https://chromiumcodereview.appspot.com/12603010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188778 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r-- | sync/engine/sync_scheduler_impl.cc | 29 | ||||
-rw-r--r-- | sync/engine/sync_scheduler_impl.h | 9 | ||||
-rw-r--r-- | sync/engine/sync_session_job.cc | 7 | ||||
-rw-r--r-- | sync/engine/sync_session_job.h | 11 |
4 files changed, 9 insertions, 47 deletions
diff --git a/sync/engine/sync_scheduler_impl.cc b/sync/engine/sync_scheduler_impl.cc index 8dd3ee6..0f55c5f 100644 --- a/sync/engine/sync_scheduler_impl.cc +++ b/sync/engine/sync_scheduler_impl.cc @@ -184,11 +184,6 @@ SyncSchedulerImpl::~SyncSchedulerImpl() { StopImpl(base::Closure()); } -void SyncSchedulerImpl::OnJobDestroyed(SyncSessionJob* job) { - // TODO(tim): Bug 165561 investigation. - CHECK(!pending_nudge_ || pending_nudge_ != job); -} - void SyncSchedulerImpl::OnCredentialsUpdated() { DCHECK_EQ(MessageLoop::current(), sync_loop_); @@ -327,7 +322,6 @@ bool SyncSchedulerImpl::ScheduleConfiguration( TimeTicks::Now(), session.Pass(), params)); - job->set_destruction_observer(weak_ptr_factory_.GetWeakPtr()); bool succeeded = DoSyncSessionJob(job.Pass(), NORMAL_PRIORITY); // If we failed, the job would have been saved as the pending configure @@ -491,7 +485,7 @@ void SyncSchedulerImpl::HandleSaveJobDecision(scoped_ptr<SyncSessionJob> job) { if (wait_interval_.get() && !wait_interval_->pending_configure_job) { // This job should be made the new canary. if (is_nudge) { - set_pending_nudge(job_to_save.get()); + pending_nudge_ = job_to_save.get(); } else { SDVLOG(2) << "Saving a configuration job"; DCHECK_EQ(job->purpose(), SyncSessionJob::CONFIGURATION); @@ -503,7 +497,7 @@ void SyncSchedulerImpl::HandleSaveJobDecision(scoped_ptr<SyncSessionJob> job) { if (pending_nudge_) { // Pre-empt the nudge canary and abandon the old nudge (owned by task). unscheduled_nudge_storage_ = pending_nudge_->CloneAndAbandon(); - set_pending_nudge(unscheduled_nudge_storage_.get()); + pending_nudge_ = unscheduled_nudge_storage_.get(); } wait_interval_->pending_configure_job = job_to_save.get(); } @@ -520,7 +514,7 @@ void SyncSchedulerImpl::HandleSaveJobDecision(scoped_ptr<SyncSessionJob> job) { DCHECK(is_nudge); // There may or may not be a pending_configure_job. Either way this nudge // is unschedulable. - set_pending_nudge(job_to_save.get()); + pending_nudge_ = job_to_save.get(); unscheduled_nudge_storage_ = job_to_save.Pass(); } @@ -599,7 +593,6 @@ void SyncSchedulerImpl::ScheduleNudgeImpl( TimeTicks::Now() + delay, CreateSyncSession(info).Pass(), ConfigurationParams())); - job->set_destruction_observer(weak_ptr_factory_.GetWeakPtr()); JobProcessDecision decision = DecideOnJob(*job, NORMAL_PRIORITY); SDVLOG(2) << "Should run " << SyncSessionJob::GetPurposeString(job->purpose()) @@ -709,7 +702,7 @@ void SyncSchedulerImpl::ScheduleSyncSessionJob( SDVLOG_LOC(loc, 2) << "Resetting pending_nudge to "; DCHECK(!pending_nudge_ || pending_nudge_->session() == job->session()); - set_pending_nudge(job.get()); + pending_nudge_ = job.get(); } PostDelayedTask(loc, "DoSyncSessionJob", @@ -807,11 +800,6 @@ bool SyncSchedulerImpl::FinishSyncSessionJob(scoped_ptr<SyncSessionJob> job, return succeeded; } -void SyncSchedulerImpl::set_pending_nudge(SyncSessionJob* job) { - job->set_destruction_observer(weak_ptr_factory_.GetWeakPtr()); - pending_nudge_ = job; -} - void SyncSchedulerImpl::ScheduleNextSync( scoped_ptr<SyncSessionJob> finished_job, bool succeeded) { DCHECK_EQ(MessageLoop::current(), sync_loop_); @@ -835,7 +823,7 @@ void SyncSchedulerImpl::ScheduleNextSync( // any job through while in WaitInterval::THROTTLED). scoped_ptr<SyncSessionJob> clone = finished_job->Clone(); if (clone->purpose() == SyncSessionJob::NUDGE) - set_pending_nudge(clone.get()); + pending_nudge_ = clone.get(); else if (clone->purpose() == SyncSessionJob::CONFIGURATION) wait_interval_->pending_configure_job = clone.get(); else @@ -871,7 +859,7 @@ void SyncSchedulerImpl::ScheduleNextSync( DCHECK(!pending_nudge_); scoped_ptr<SyncSessionJob> new_job = finished_job->Clone(); - set_pending_nudge(new_job.get()); + pending_nudge_ = new_job.get(); RestartWaiting(new_job.Pass()); } else { // Either this is the first failure or a consecutive failure after our @@ -949,7 +937,7 @@ void SyncSchedulerImpl::HandleContinuationError( // should be null. DCHECK(wait_interval_->pending_configure_job == NULL); DCHECK(!pending_nudge_); - set_pending_nudge(new_job.get()); + pending_nudge_ = new_job.get(); } RestartWaiting(new_job.Pass()); @@ -1017,7 +1005,7 @@ scoped_ptr<SyncSessionJob> SyncSchedulerImpl::TakePendingJobForCurrentMode() { } else if (mode_ == NORMAL_MODE && pending_nudge_) { SDVLOG(2) << "Found pending nudge job"; candidate = pending_nudge_->CloneAndAbandon(); - set_pending_nudge(candidate.get()); + pending_nudge_ = candidate.get(); unscheduled_nudge_storage_.reset(); } // If we took a job and there's a wait interval, we took the pending canary. @@ -1047,7 +1035,6 @@ void SyncSchedulerImpl::PollTimerCallback() { TimeTicks::Now(), s.Pass(), ConfigurationParams())); - job->set_destruction_observer(weak_ptr_factory_.GetWeakPtr()); ScheduleSyncSessionJob(FROM_HERE, job.Pass()); } diff --git a/sync/engine/sync_scheduler_impl.h b/sync/engine/sync_scheduler_impl.h index 7eba048..7190bdf6 100644 --- a/sync/engine/sync_scheduler_impl.h +++ b/sync/engine/sync_scheduler_impl.h @@ -33,9 +33,7 @@ namespace syncer { class BackoffDelayProvider; -class SYNC_EXPORT_PRIVATE SyncSchedulerImpl : - public SyncScheduler, - public SyncSessionJob::DestructionObserver { +class SYNC_EXPORT_PRIVATE SyncSchedulerImpl : public SyncScheduler { public: // |name| is a display string to identify the syncer thread. Takes // |ownership of |syncer| and |delay_provider|. @@ -81,9 +79,6 @@ class SYNC_EXPORT_PRIVATE SyncSchedulerImpl : virtual void OnSyncProtocolError( const sessions::SyncSessionSnapshot& snapshot) OVERRIDE; - // SyncSessionJob::DestructionObserver implementation. - virtual void OnJobDestroyed(SyncSessionJob* job) OVERRIDE; - private: enum JobProcessDecision { // Indicates we should continue with the current job. @@ -273,8 +268,6 @@ class SYNC_EXPORT_PRIVATE SyncSchedulerImpl : virtual void OnActionableError(const sessions::SyncSessionSnapshot& snapshot); - void set_pending_nudge(SyncSessionJob* job); - base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_; // A second factory specially for weak_handle_this_, to allow the handle diff --git a/sync/engine/sync_session_job.cc b/sync/engine/sync_session_job.cc index f18e010..f0d0d33 100644 --- a/sync/engine/sync_session_job.cc +++ b/sync/engine/sync_session_job.cc @@ -8,8 +8,6 @@ namespace syncer { SyncSessionJob::~SyncSessionJob() { - if (destruction_observer_) - destruction_observer_->OnJobDestroyed(this); } SyncSessionJob::SyncSessionJob( @@ -24,11 +22,6 @@ SyncSessionJob::SyncSessionJob( finished_(NOT_FINISHED) { } -void SyncSessionJob::set_destruction_observer( - const base::WeakPtr<DestructionObserver>& destruction_observer) { - destruction_observer_ = destruction_observer; -} - #define ENUM_CASE(x) case x: return #x; break; const char* SyncSessionJob::GetPurposeString(SyncSessionJob::Purpose purpose) { switch (purpose) { diff --git a/sync/engine/sync_session_job.h b/sync/engine/sync_session_job.h index b57f227..33d2171 100644 --- a/sync/engine/sync_session_job.h +++ b/sync/engine/sync_session_job.h @@ -31,13 +31,6 @@ class SYNC_EXPORT_PRIVATE SyncSessionJob { CONFIGURATION, }; - // This class exists to inform an interested party about the destruction of - // a SyncSessionJob. - class SYNC_EXPORT_PRIVATE DestructionObserver { - public: - virtual void OnJobDestroyed(SyncSessionJob* job) = 0; - }; - SyncSessionJob(Purpose purpose, base::TimeTicks start, scoped_ptr<sessions::SyncSession> session, @@ -84,8 +77,6 @@ class SYNC_EXPORT_PRIVATE SyncSessionJob { SyncerStep end_step() const; ConfigurationParams config_params() const; - void set_destruction_observer( - const base::WeakPtr<DestructionObserver>& observer); private: // A SyncSessionJob can be in one of these three states, controlled by the // Finish() function, see method comments. @@ -111,8 +102,6 @@ class SYNC_EXPORT_PRIVATE SyncSessionJob { // all requisite steps given |purpose_| without being preempted. FinishedState finished_; - base::WeakPtr<DestructionObserver> destruction_observer_; - DISALLOW_COPY_AND_ASSIGN(SyncSessionJob); }; |