Chromium Code Reviews| 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/engine/download_updates_command.h" | 5 #include "sync/engine/download_updates_command.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "sync/engine/syncer.h" | 10 #include "sync/engine/syncer.h" |
| 11 #include "sync/engine/syncer_proto_util.h" | 11 #include "sync/engine/syncer_proto_util.h" |
| 12 #include "sync/internal_api/public/base/model_type_state_map.h" | 12 #include "sync/internal_api/public/base/model_type_invalidation_map.h" |
| 13 #include "sync/syncable/directory.h" | 13 #include "sync/syncable/directory.h" |
| 14 #include "sync/syncable/nigori_handler.h" | 14 #include "sync/syncable/nigori_handler.h" |
| 15 #include "sync/syncable/read_transaction.h" | 15 #include "sync/syncable/read_transaction.h" |
| 16 | 16 |
| 17 using sync_pb::DebugInfo; | 17 using sync_pb::DebugInfo; |
| 18 | 18 |
| 19 namespace syncer { | 19 namespace syncer { |
| 20 using sessions::StatusController; | 20 using sessions::StatusController; |
| 21 using sessions::SyncSession; | 21 using sessions::SyncSession; |
| 22 using std::string; | 22 using std::string; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 | 66 |
| 67 syncable::Directory* dir = session->context()->directory(); | 67 syncable::Directory* dir = session->context()->directory(); |
| 68 | 68 |
| 69 // Request updates for all enabled types. | 69 // Request updates for all enabled types. |
| 70 const ModelTypeSet enabled_types = | 70 const ModelTypeSet enabled_types = |
| 71 GetRoutingInfoTypes(session->routing_info()); | 71 GetRoutingInfoTypes(session->routing_info()); |
| 72 DVLOG(1) << "Getting updates for types " | 72 DVLOG(1) << "Getting updates for types " |
| 73 << ModelTypeSetToString(enabled_types); | 73 << ModelTypeSetToString(enabled_types); |
| 74 DCHECK(!enabled_types.Empty()); | 74 DCHECK(!enabled_types.Empty()); |
| 75 | 75 |
| 76 const ModelTypeStateMap& type_state_map = session->source().types; | 76 const ModelTypeInvalidationMap& invalidation_map = |
| 77 session->source().types; | |
| 77 for (ModelTypeSet::Iterator it = enabled_types.First(); | 78 for (ModelTypeSet::Iterator it = enabled_types.First(); |
| 78 it.Good(); it.Inc()) { | 79 it.Good(); it.Inc()) { |
| 79 sync_pb::DataTypeProgressMarker* progress_marker = | 80 sync_pb::DataTypeProgressMarker* progress_marker = |
| 80 get_updates->add_from_progress_marker(); | 81 get_updates->add_from_progress_marker(); |
| 81 dir->GetDownloadProgress(it.Get(), progress_marker); | 82 dir->GetDownloadProgress(it.Get(), progress_marker); |
| 82 | 83 |
| 83 // Set notification hint if present. | 84 // Set notification hint if present. |
| 84 ModelTypeStateMap::const_iterator type_state = | 85 ModelTypeInvalidationMap::const_iterator invalidation = |
|
akalin
2012/10/04 00:55:31
maybe it2?
dcheng
2012/10/04 01:12:30
Done. (I used find_it since I find it/it2 to be a
| |
| 85 type_state_map.find(it.Get()); | 86 invalidation_map.find(it.Get()); |
| 86 if (type_state != type_state_map.end()) { | 87 if (invalidation != invalidation_map.end()) { |
| 87 progress_marker->set_notification_hint(type_state->second.payload); | 88 progress_marker->set_notification_hint(invalidation->second.payload); |
| 88 } | 89 } |
| 89 } | 90 } |
| 90 | 91 |
| 91 bool need_encryption_key = false; | 92 bool need_encryption_key = false; |
| 92 if (session->context()->keystore_encryption_enabled()) { | 93 if (session->context()->keystore_encryption_enabled()) { |
| 93 syncable::Directory* dir = session->context()->directory(); | 94 syncable::Directory* dir = session->context()->directory(); |
| 94 syncable::ReadTransaction trans(FROM_HERE, dir); | 95 syncable::ReadTransaction trans(FROM_HERE, dir); |
| 95 syncable::NigoriHandler* nigori_handler = dir->GetNigoriHandler(); | 96 syncable::NigoriHandler* nigori_handler = dir->GetNigoriHandler(); |
| 96 need_encryption_key = nigori_handler->NeedKeystoreKey(&trans); | 97 need_encryption_key = nigori_handler->NeedKeystoreKey(&trans); |
| 97 get_updates->set_need_encryption_key(need_encryption_key); | 98 get_updates->set_need_encryption_key(need_encryption_key); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 // could be null in some unit tests. | 156 // could be null in some unit tests. |
| 156 if (session->context()->debug_info_getter()) { | 157 if (session->context()->debug_info_getter()) { |
| 157 session->context()->debug_info_getter()->GetAndClearDebugInfo( | 158 session->context()->debug_info_getter()->GetAndClearDebugInfo( |
| 158 debug_info); | 159 debug_info); |
| 159 } | 160 } |
| 160 session->mutable_status_controller()->set_debug_info_sent(); | 161 session->mutable_status_controller()->set_debug_info_sent(); |
| 161 } | 162 } |
| 162 } | 163 } |
| 163 | 164 |
| 164 } // namespace syncer | 165 } // namespace syncer |
| OLD | NEW |