Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: sync/internal_api/sync_manager_impl.cc

Issue 152013003: Split up SyncEngineEventListener callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One more forward declaration Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/internal_api/sync_manager_impl.h ('k') | sync/sessions/status_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/internal_api/sync_manager_impl.h" 5 #include "sync/internal_api/sync_manager_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 // TODO(lipalani) : Calculate the nudge delay based on all types. 906 // TODO(lipalani) : Calculate the nudge delay based on all types.
907 base::TimeDelta nudge_delay = NudgeStrategy::GetNudgeDelayTimeDelta( 907 base::TimeDelta nudge_delay = NudgeStrategy::GetNudgeDelayTimeDelta(
908 types.First().Get(), 908 types.First().Get(),
909 this); 909 this);
910 allstatus_.IncrementNudgeCounter(NUDGE_SOURCE_LOCAL); 910 allstatus_.IncrementNudgeCounter(NUDGE_SOURCE_LOCAL);
911 scheduler_->ScheduleLocalNudge(nudge_delay, 911 scheduler_->ScheduleLocalNudge(nudge_delay,
912 types, 912 types,
913 nudge_location); 913 nudge_location);
914 } 914 }
915 915
916 void SyncManagerImpl::OnSyncEngineEvent(const SyncEngineEvent& event) { 916 void SyncManagerImpl::OnSyncCycleEvent(const SyncCycleEvent& event) {
917 DCHECK(thread_checker_.CalledOnValidThread()); 917 DCHECK(thread_checker_.CalledOnValidThread());
918 // Only send an event if this is due to a cycle ending and this cycle 918 // Only send an event if this is due to a cycle ending and this cycle
919 // concludes a canonical "sync" process; that is, based on what is known 919 // concludes a canonical "sync" process; that is, based on what is known
920 // locally we are "all happy" and up-to-date. There may be new changes on 920 // locally we are "all happy" and up-to-date. There may be new changes on
921 // the server, but we'll get them on a subsequent sync. 921 // the server, but we'll get them on a subsequent sync.
922 // 922 //
923 // Notifications are sent at the end of every sync cycle, regardless of 923 // Notifications are sent at the end of every sync cycle, regardless of
924 // whether we should sync again. 924 // whether we should sync again.
925 if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) { 925 if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_ENDED) {
926 if (!initialized_) { 926 if (!initialized_) {
927 DVLOG(1) << "OnSyncCycleCompleted not sent because sync api is not " 927 DVLOG(1) << "OnSyncCycleCompleted not sent because sync api is not "
928 << "initialized"; 928 << "initialized";
929 return; 929 return;
930 } 930 }
931 931
932 DVLOG(1) << "Sending OnSyncCycleCompleted"; 932 DVLOG(1) << "Sending OnSyncCycleCompleted";
933 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, 933 FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
934 OnSyncCycleCompleted(event.snapshot)); 934 OnSyncCycleCompleted(event.snapshot));
935 } 935 }
936 }
936 937
937 if (event.what_happened == SyncEngineEvent::STOP_SYNCING_PERMANENTLY) { 938 void SyncManagerImpl::OnActionableError(const SyncProtocolError& error) {
938 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, 939 FOR_EACH_OBSERVER(
939 OnStopSyncingPermanently()); 940 SyncManager::Observer, observers_,
940 return; 941 OnActionableError(error));
941 } 942 }
942 943
943 if (event.what_happened == SyncEngineEvent::ACTIONABLE_ERROR) { 944 void SyncManagerImpl::OnRetryTimeChanged(base::Time) {}
944 FOR_EACH_OBSERVER( 945
945 SyncManager::Observer, observers_, 946 void SyncManagerImpl::OnThrottledTypesChanged(ModelTypeSet) {}
946 OnActionableError(
947 event.snapshot.model_neutral_state().sync_protocol_error));
948 return;
949 }
950 }
951 947
952 void SyncManagerImpl::SetJsEventHandler( 948 void SyncManagerImpl::SetJsEventHandler(
953 const WeakHandle<JsEventHandler>& event_handler) { 949 const WeakHandle<JsEventHandler>& event_handler) {
954 js_event_handler_ = event_handler; 950 js_event_handler_ = event_handler;
955 js_sync_manager_observer_.SetJsEventHandler(js_event_handler_); 951 js_sync_manager_observer_.SetJsEventHandler(js_event_handler_);
956 js_mutation_event_observer_.SetJsEventHandler(js_event_handler_); 952 js_mutation_event_observer_.SetJsEventHandler(js_event_handler_);
957 js_sync_encryption_handler_observer_.SetJsEventHandler(js_event_handler_); 953 js_sync_encryption_handler_observer_.SetJsEventHandler(js_event_handler_);
958 } 954 }
959 955
960 void SyncManagerImpl::ProcessJsMessage( 956 void SyncManagerImpl::ProcessJsMessage(
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 int SyncManagerImpl::GetDefaultNudgeDelay() { 1236 int SyncManagerImpl::GetDefaultNudgeDelay() {
1241 return kDefaultNudgeDelayMilliseconds; 1237 return kDefaultNudgeDelayMilliseconds;
1242 } 1238 }
1243 1239
1244 // static. 1240 // static.
1245 int SyncManagerImpl::GetPreferencesNudgeDelay() { 1241 int SyncManagerImpl::GetPreferencesNudgeDelay() {
1246 return kPreferencesNudgeDelayMilliseconds; 1242 return kPreferencesNudgeDelayMilliseconds;
1247 } 1243 }
1248 1244
1249 } // namespace syncer 1245 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/sync_manager_impl.h ('k') | sync/sessions/status_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698