OLD | NEW |
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/sessions/sync_session.h" | 5 #include "sync/sessions/sync_session.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 status_controller_->sync_start_time(), | 62 status_controller_->sync_start_time(), |
63 num_entries_by_type, | 63 num_entries_by_type, |
64 num_to_delete_entries_by_type, | 64 num_to_delete_entries_by_type, |
65 legacy_updates_source); | 65 legacy_updates_source); |
66 | 66 |
67 return snapshot; | 67 return snapshot; |
68 } | 68 } |
69 | 69 |
70 void SyncSession::SendSyncCycleEndEventNotification( | 70 void SyncSession::SendSyncCycleEndEventNotification( |
71 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { | 71 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { |
72 SyncEngineEvent event(SyncEngineEvent::SYNC_CYCLE_ENDED); | 72 SyncCycleEvent event(SyncCycleEvent::SYNC_CYCLE_ENDED); |
73 event.snapshot = TakeSnapshotWithSource(source); | 73 event.snapshot = TakeSnapshotWithSource(source); |
74 | 74 |
75 DVLOG(1) << "Sending cycle end event with snapshot: " | 75 DVLOG(1) << "Sending cycle end event with snapshot: " |
76 << event.snapshot.ToString(); | 76 << event.snapshot.ToString(); |
77 context()->NotifyListeners(event); | 77 FOR_EACH_OBSERVER(SyncEngineEventListener, |
| 78 *(context_->listeners()), |
| 79 OnSyncCycleEvent(event)); |
78 } | 80 } |
79 | 81 |
80 void SyncSession::SendEventNotification(SyncEngineEvent::EventCause cause) { | 82 void SyncSession::SendEventNotification(SyncCycleEvent::EventCause cause) { |
81 SyncEngineEvent event(cause); | 83 SyncCycleEvent event(cause); |
82 event.snapshot = TakeSnapshot(); | 84 event.snapshot = TakeSnapshot(); |
83 | 85 |
84 DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString(); | 86 DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString(); |
85 context()->NotifyListeners(event); | 87 FOR_EACH_OBSERVER(SyncEngineEventListener, |
| 88 *(context_->listeners()), |
| 89 OnSyncCycleEvent(event)); |
86 } | 90 } |
87 | 91 |
88 } // namespace sessions | 92 } // namespace sessions |
89 } // namespace syncer | 93 } // namespace syncer |
OLD | NEW |