diff options
author | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-11 13:56:43 +0000 |
---|---|---|
committer | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-11 13:56:43 +0000 |
commit | 325c350df9c95200a5363a3a4ef9dea4af5d807e (patch) | |
tree | c3d45d16a034f61b83b1295c43c021298f564901 /sync/sessions | |
parent | 3d146b44d0be75328ac1873042141ba76778cfc0 (diff) | |
download | chromium_src-325c350df9c95200a5363a3a4ef9dea4af5d807e.zip chromium_src-325c350df9c95200a5363a3a4ef9dea4af5d807e.tar.gz chromium_src-325c350df9c95200a5363a3a4ef9dea4af5d807e.tar.bz2 |
Split up SyncEngineEventListener callbacks
Splits up the SyncEngineEventListener calls into one callback per event
type. This allow us to trim the 'event' objects so they only contain
elements relevant to their event.
Also removes some dead code related to STOP_SYNCING_PERMANENTLY, which
is no longer in use. It may have been used for birthday errors in the
past, but those are now handled with ActionableError. It was used for
CLEAR_USER_DATA, but that feature is no longer supported.
BUG=339984
Review URL: https://codereview.chromium.org/152013003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250384 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/sessions')
-rw-r--r-- | sync/sessions/status_controller.cc | 5 | ||||
-rw-r--r-- | sync/sessions/status_controller.h | 1 | ||||
-rw-r--r-- | sync/sessions/sync_session.cc | 14 | ||||
-rw-r--r-- | sync/sessions/sync_session.h | 6 | ||||
-rw-r--r-- | sync/sessions/sync_session_context.h | 7 |
5 files changed, 16 insertions, 17 deletions
diff --git a/sync/sessions/status_controller.cc b/sync/sessions/status_controller.cc index 752b9ab..ec79087 100644 --- a/sync/sessions/status_controller.cc +++ b/sync/sessions/status_controller.cc @@ -81,11 +81,6 @@ void StatusController::increment_num_server_overwrites() { model_neutral_.num_server_overwrites++; } -void StatusController::set_sync_protocol_error( - const SyncProtocolError& error) { - model_neutral_.sync_protocol_error = error; -} - void StatusController::set_last_get_key_result(const SyncerError result) { model_neutral_.last_get_key_result = result; } diff --git a/sync/sessions/status_controller.h b/sync/sessions/status_controller.h index 005f158..e1bf8a9 100644 --- a/sync/sessions/status_controller.h +++ b/sync/sessions/status_controller.h @@ -92,7 +92,6 @@ class SYNC_EXPORT_PRIVATE StatusController { void set_num_successful_bookmark_commits(int value); // Server communication status tracking. - void set_sync_protocol_error(const SyncProtocolError& error); void set_last_get_key_result(const SyncerError result); void set_last_download_updates_result(const SyncerError result); void set_commit_result(const SyncerError result); diff --git a/sync/sessions/sync_session.cc b/sync/sessions/sync_session.cc index 030ef0f..957cfbf 100644 --- a/sync/sessions/sync_session.cc +++ b/sync/sessions/sync_session.cc @@ -69,20 +69,24 @@ SyncSessionSnapshot SyncSession::TakeSnapshotWithSource( void SyncSession::SendSyncCycleEndEventNotification( sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { - SyncEngineEvent event(SyncEngineEvent::SYNC_CYCLE_ENDED); + SyncCycleEvent event(SyncCycleEvent::SYNC_CYCLE_ENDED); event.snapshot = TakeSnapshotWithSource(source); DVLOG(1) << "Sending cycle end event with snapshot: " << event.snapshot.ToString(); - context()->NotifyListeners(event); + FOR_EACH_OBSERVER(SyncEngineEventListener, + *(context_->listeners()), + OnSyncCycleEvent(event)); } -void SyncSession::SendEventNotification(SyncEngineEvent::EventCause cause) { - SyncEngineEvent event(cause); +void SyncSession::SendEventNotification(SyncCycleEvent::EventCause cause) { + SyncCycleEvent event(cause); event.snapshot = TakeSnapshot(); DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString(); - context()->NotifyListeners(event); + FOR_EACH_OBSERVER(SyncEngineEventListener, + *(context_->listeners()), + OnSyncCycleEvent(event)); } } // namespace sessions diff --git a/sync/sessions/sync_session.h b/sync/sessions/sync_session.h index e25c718..a0e4176 100644 --- a/sync/sessions/sync_session.h +++ b/sync/sessions/sync_session.h @@ -20,9 +20,11 @@ #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "sync/base/sync_export.h" +#include "sync/engine/sync_cycle_event.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/engine/model_safe_worker.h" #include "sync/internal_api/public/sessions/sync_session_snapshot.h" +#include "sync/protocol/sync_protocol_error.h" #include "sync/sessions/status_controller.h" #include "sync/sessions/sync_session_context.h" @@ -75,7 +77,7 @@ class SYNC_EXPORT_PRIVATE SyncSession { // Called for the syncer to respond to the error sent by the server. virtual void OnSyncProtocolError( - const sessions::SyncSessionSnapshot& snapshot) = 0; + const SyncProtocolError& sync_protocol_error) = 0; // Called when the server wants to change the number of hints the client // will buffer locally. @@ -103,7 +105,7 @@ class SYNC_EXPORT_PRIVATE SyncSession { // Builds and sends a snapshot to the session context's listeners. void SendSyncCycleEndEventNotification( sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); - void SendEventNotification(SyncEngineEvent::EventCause cause); + void SendEventNotification(SyncCycleEvent::EventCause cause); // TODO(akalin): Split this into context() and mutable_context(). SyncSessionContext* context() const { return context_; } diff --git a/sync/sessions/sync_session_context.h b/sync/sessions/sync_session_context.h index 6303de8..f1afa7d 100644 --- a/sync/sessions/sync_session_context.h +++ b/sync/sessions/sync_session_context.h @@ -18,7 +18,7 @@ #include <string> #include "sync/base/sync_export.h" -#include "sync/engine/sync_engine_event.h" +#include "sync/engine/sync_engine_event_listener.h" #include "sync/engine/traffic_recorder.h" #include "sync/sessions/debug_info_getter.h" #include "sync/sessions/model_type_registry.h" @@ -94,9 +94,8 @@ class SYNC_EXPORT_PRIVATE SyncSessionContext { } int32 max_commit_batch_size() const { return max_commit_batch_size_; } - void NotifyListeners(const SyncEngineEvent& event) { - FOR_EACH_OBSERVER(SyncEngineEventListener, listeners_, - OnSyncEngineEvent(event)); + ObserverList<SyncEngineEventListener>* listeners() { + return &listeners_; } TrafficRecorder* traffic_recorder() { |