summaryrefslogtreecommitdiffstats
path: root/sync/internal_api
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-11 13:56:43 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-11 13:56:43 +0000
commit325c350df9c95200a5363a3a4ef9dea4af5d807e (patch)
treec3d45d16a034f61b83b1295c43c021298f564901 /sync/internal_api
parent3d146b44d0be75328ac1873042141ba76778cfc0 (diff)
downloadchromium_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/internal_api')
-rw-r--r--sync/internal_api/public/sessions/model_neutral_state.h5
-rw-r--r--sync/internal_api/sync_manager_impl.cc26
-rw-r--r--sync/internal_api/sync_manager_impl.h7
3 files changed, 17 insertions, 21 deletions
diff --git a/sync/internal_api/public/sessions/model_neutral_state.h b/sync/internal_api/public/sessions/model_neutral_state.h
index 4979d3a..beafcb9 100644
--- a/sync/internal_api/public/sessions/model_neutral_state.h
+++ b/sync/internal_api/public/sessions/model_neutral_state.h
@@ -7,9 +7,9 @@
#include "base/basictypes.h"
#include "sync/base/sync_export.h"
+#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/util/syncer_error.h"
#include "sync/protocol/sync.pb.h"
-#include "sync/protocol/sync_protocol_error.h"
namespace syncer {
namespace sessions {
@@ -49,9 +49,6 @@ struct SYNC_EXPORT ModelNeutralState {
int num_local_overwrites;
int num_server_overwrites;
- // Any protocol errors that we received during this sync session.
- SyncProtocolError sync_protocol_error;
-
// Records the most recent results of GetKey, PostCommit and GetUpdates
// commands.
SyncerError last_get_key_result;
diff --git a/sync/internal_api/sync_manager_impl.cc b/sync/internal_api/sync_manager_impl.cc
index 1256d0b..e970b22 100644
--- a/sync/internal_api/sync_manager_impl.cc
+++ b/sync/internal_api/sync_manager_impl.cc
@@ -913,7 +913,7 @@ void SyncManagerImpl::RequestNudgeForDataTypes(
nudge_location);
}
-void SyncManagerImpl::OnSyncEngineEvent(const SyncEngineEvent& event) {
+void SyncManagerImpl::OnSyncCycleEvent(const SyncCycleEvent& event) {
DCHECK(thread_checker_.CalledOnValidThread());
// Only send an event if this is due to a cycle ending and this cycle
// concludes a canonical "sync" process; that is, based on what is known
@@ -922,7 +922,7 @@ void SyncManagerImpl::OnSyncEngineEvent(const SyncEngineEvent& event) {
//
// Notifications are sent at the end of every sync cycle, regardless of
// whether we should sync again.
- if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) {
+ if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_ENDED) {
if (!initialized_) {
DVLOG(1) << "OnSyncCycleCompleted not sent because sync api is not "
<< "initialized";
@@ -933,22 +933,18 @@ void SyncManagerImpl::OnSyncEngineEvent(const SyncEngineEvent& event) {
FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
OnSyncCycleCompleted(event.snapshot));
}
+}
- if (event.what_happened == SyncEngineEvent::STOP_SYNCING_PERMANENTLY) {
- FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
- OnStopSyncingPermanently());
- return;
- }
-
- if (event.what_happened == SyncEngineEvent::ACTIONABLE_ERROR) {
- FOR_EACH_OBSERVER(
- SyncManager::Observer, observers_,
- OnActionableError(
- event.snapshot.model_neutral_state().sync_protocol_error));
- return;
- }
+void SyncManagerImpl::OnActionableError(const SyncProtocolError& error) {
+ FOR_EACH_OBSERVER(
+ SyncManager::Observer, observers_,
+ OnActionableError(error));
}
+void SyncManagerImpl::OnRetryTimeChanged(base::Time) {}
+
+void SyncManagerImpl::OnThrottledTypesChanged(ModelTypeSet) {}
+
void SyncManagerImpl::SetJsEventHandler(
const WeakHandle<JsEventHandler>& event_handler) {
js_event_handler_ = event_handler;
diff --git a/sync/internal_api/sync_manager_impl.h b/sync/internal_api/sync_manager_impl.h
index 4ed0b97..01488c1 100644
--- a/sync/internal_api/sync_manager_impl.h
+++ b/sync/internal_api/sync_manager_impl.h
@@ -12,7 +12,7 @@
#include "sync/base/sync_export.h"
#include "sync/engine/all_status.h"
#include "sync/engine/net/server_connection_manager.h"
-#include "sync/engine/sync_engine_event.h"
+#include "sync/engine/sync_engine_event_listener.h"
#include "sync/engine/traffic_recorder.h"
#include "sync/internal_api/change_reorder_buffer.h"
#include "sync/internal_api/debug_info_event_listener.h"
@@ -136,7 +136,10 @@ class SYNC_EXPORT_PRIVATE SyncManagerImpl :
static int GetPreferencesNudgeDelay();
// SyncEngineEventListener implementation.
- virtual void OnSyncEngineEvent(const SyncEngineEvent& event) OVERRIDE;
+ virtual void OnSyncCycleEvent(const SyncCycleEvent& event) OVERRIDE;
+ virtual void OnActionableError(const SyncProtocolError& error) OVERRIDE;
+ virtual void OnRetryTimeChanged(base::Time retry_time) OVERRIDE;
+ virtual void OnThrottledTypesChanged(ModelTypeSet throttled_types) OVERRIDE;
// ServerConnectionEventListener implementation.
virtual void OnServerConnectionEvent(