Chromium Code Reviews

Unified Diff: chrome/browser/sync/engine/syncer.cc

Issue 2075012: Replace changes_channel with an observer list. (Closed)
Patch Set: Ready for checkin Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « chrome/browser/sync/engine/syncer.h ('k') | chrome/browser/sync/engine/syncer_command.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/syncer.cc
diff --git a/chrome/browser/sync/engine/syncer.cc b/chrome/browser/sync/engine/syncer.cc
index 24c471bf13687641b23ae265bcf5959125d9cf23..2956a046c457af86b1840eb1e726c7f291ba333e 100644
--- a/chrome/browser/sync/engine/syncer.cc
+++ b/chrome/browser/sync/engine/syncer.cc
@@ -55,24 +55,29 @@ using sessions::ConflictProgress;
Syncer::Syncer(sessions::SyncSessionContext* context)
: early_exit_requested_(false),
max_commit_batch_size_(kDefaultMaxCommitBatchSize),
- syncer_event_channel_(new SyncerEventChannel(SyncerEvent(
- SyncerEvent::SHUTDOWN_USE_WITH_CARE))),
+ syncer_event_channel_(new SyncerEventChannel()),
resolver_scoper_(context, &resolver_),
event_channel_scoper_(context, syncer_event_channel_.get()),
context_(context),
updates_source_(sync_pb::GetUpdatesCallerInfo::UNKNOWN),
pre_conflict_resolution_closure_(NULL) {
- shutdown_channel_.reset(new ShutdownChannel(this));
+ shutdown_channel_.reset(new ShutdownChannel());
ScopedDirLookup dir(context->directory_manager(), context->account_name());
// The directory must be good here.
CHECK(dir.good());
}
+Syncer::~Syncer() {
+ syncer_event_channel_->Notify(
+ SyncerEvent(SyncerEvent::SHUTDOWN_USE_WITH_CARE));
+ shutdown_channel_->Notify(SyncerShutdownEvent(this));
+}
+
void Syncer::RequestNudge(int milliseconds) {
SyncerEvent event(SyncerEvent::REQUEST_SYNC_NUDGE);
event.nudge_delay_milliseconds = milliseconds;
- syncer_event_channel_->NotifyListeners(event);
+ syncer_event_channel_->Notify(event);
}
bool Syncer::SyncShare(sessions::SyncSession::Delegate* delegate) {
« no previous file with comments | « chrome/browser/sync/engine/syncer.h ('k') | chrome/browser/sync/engine/syncer_command.cc » ('j') | no next file with comments »

Powered by Google App Engine