OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/get_updates_delegate.h" | 5 #include "components/sync/engine_impl/get_updates_delegate.h" |
6 | 6 |
7 #include "components/sync/engine/events/configure_get_updates_request_event.h" | 7 #include "components/sync/engine/events/configure_get_updates_request_event.h" |
8 #include "components/sync/engine/events/normal_get_updates_request_event.h" | 8 #include "components/sync/engine/events/normal_get_updates_request_event.h" |
9 #include "components/sync/engine/events/poll_get_updates_request_event.h" | 9 #include "components/sync/engine/events/poll_get_updates_request_event.h" |
10 #include "components/sync/engine_impl/directory_update_handler.h" | 10 #include "components/sync/engine_impl/directory_update_handler.h" |
11 #include "components/sync/engine_impl/get_updates_processor.h" | 11 #include "components/sync/engine_impl/get_updates_processor.h" |
12 | 12 |
13 namespace syncer { | 13 namespace syncer { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 void NonPassiveApplyUpdates(ModelTypeSet gu_types, | 17 void NonPassiveApplyUpdates(ModelTypeSet gu_types, |
18 StatusController* status_controller, | 18 StatusController* status_controller, |
19 UpdateHandlerMap* update_handler_map) { | 19 UpdateHandlerMap* update_handler_map) { |
20 for (UpdateHandlerMap::iterator it = update_handler_map->begin(); | 20 for (const auto& kv : *update_handler_map) { |
21 it != update_handler_map->end(); ++it) { | 21 if (gu_types.Has(kv.first)) { |
22 if (gu_types.Has(it->first)) | 22 kv.second->ApplyUpdates(status_controller); |
23 it->second->ApplyUpdates(status_controller); | 23 } |
24 } | 24 } |
25 } | 25 } |
26 | 26 |
27 void PassiveApplyUpdates(ModelTypeSet gu_types, | 27 void PassiveApplyUpdates(ModelTypeSet gu_types, |
28 StatusController* status_controller, | 28 StatusController* status_controller, |
29 UpdateHandlerMap* update_handler_map) { | 29 UpdateHandlerMap* update_handler_map) { |
30 for (UpdateHandlerMap::iterator it = update_handler_map->begin(); | 30 for (const auto& kv : *update_handler_map) { |
31 it != update_handler_map->end(); ++it) { | 31 if (gu_types.Has(kv.first)) { |
32 if (gu_types.Has(it->first)) | 32 kv.second->PassiveApplyUpdates(status_controller); |
33 it->second->PassiveApplyUpdates(status_controller); | 33 } |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 GetUpdatesDelegate::GetUpdatesDelegate() {} | 39 GetUpdatesDelegate::GetUpdatesDelegate() {} |
40 | 40 |
41 GetUpdatesDelegate::~GetUpdatesDelegate() {} | 41 GetUpdatesDelegate::~GetUpdatesDelegate() {} |
42 | 42 |
43 NormalGetUpdatesDelegate::NormalGetUpdatesDelegate( | 43 NormalGetUpdatesDelegate::NormalGetUpdatesDelegate( |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 std::unique_ptr<ProtocolEvent> PollGetUpdatesDelegate::GetNetworkRequestEvent( | 164 std::unique_ptr<ProtocolEvent> PollGetUpdatesDelegate::GetNetworkRequestEvent( |
165 base::Time timestamp, | 165 base::Time timestamp, |
166 const sync_pb::ClientToServerMessage& request) const { | 166 const sync_pb::ClientToServerMessage& request) const { |
167 return std::unique_ptr<ProtocolEvent>( | 167 return std::unique_ptr<ProtocolEvent>( |
168 new PollGetUpdatesRequestEvent(timestamp, request)); | 168 new PollGetUpdatesRequestEvent(timestamp, request)); |
169 } | 169 } |
170 | 170 |
171 } // namespace syncer | 171 } // namespace syncer |
OLD | NEW |