| 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 "components/sync/engine_impl/cycle/sync_cycle.h" | 5 #include "components/sync/engine_impl/cycle/sync_cycle.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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 return snapshot; | 58 return snapshot; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void SyncCycle::SendSyncCycleEndEventNotification( | 61 void SyncCycle::SendSyncCycleEndEventNotification( |
| 62 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { | 62 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { |
| 63 SyncCycleEvent event(SyncCycleEvent::SYNC_CYCLE_ENDED); | 63 SyncCycleEvent event(SyncCycleEvent::SYNC_CYCLE_ENDED); |
| 64 event.snapshot = TakeSnapshotWithSource(source); | 64 event.snapshot = TakeSnapshotWithSource(source); |
| 65 | 65 |
| 66 DVLOG(1) << "Sending cycle end event with snapshot: " | 66 DVLOG(1) << "Sending cycle end event with snapshot: " |
| 67 << event.snapshot.ToString(); | 67 << event.snapshot.ToString(); |
| 68 FOR_EACH_OBSERVER(SyncEngineEventListener, *(context_->listeners()), | 68 for (auto& observer : *context_->listeners()) |
| 69 OnSyncCycleEvent(event)); | 69 observer.OnSyncCycleEvent(event); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void SyncCycle::SendEventNotification(SyncCycleEvent::EventCause cause) { | 72 void SyncCycle::SendEventNotification(SyncCycleEvent::EventCause cause) { |
| 73 SyncCycleEvent event(cause); | 73 SyncCycleEvent event(cause); |
| 74 event.snapshot = TakeSnapshot(); | 74 event.snapshot = TakeSnapshot(); |
| 75 | 75 |
| 76 DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString(); | 76 DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString(); |
| 77 FOR_EACH_OBSERVER(SyncEngineEventListener, *(context_->listeners()), | 77 for (auto& observer : *context_->listeners()) |
| 78 OnSyncCycleEvent(event)); | 78 observer.OnSyncCycleEvent(event); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void SyncCycle::SendProtocolEvent(const ProtocolEvent& event) { | 81 void SyncCycle::SendProtocolEvent(const ProtocolEvent& event) { |
| 82 FOR_EACH_OBSERVER(SyncEngineEventListener, *(context_->listeners()), | 82 for (auto& observer : *context_->listeners()) |
| 83 OnProtocolEvent(event)); | 83 observer.OnProtocolEvent(event); |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace syncer | 86 } // namespace syncer |
| OLD | NEW |