| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 std::back_inserter(temp)); | 143 std::back_inserter(temp)); |
| 144 workers_.swap(temp); | 144 workers_.swap(temp); |
| 145 | 145 |
| 146 // Now update enabled groups. | 146 // Now update enabled groups. |
| 147 enabled_groups_ = ComputeEnabledGroups(routing_info_, workers_); | 147 enabled_groups_ = ComputeEnabledGroups(routing_info_, workers_); |
| 148 } | 148 } |
| 149 | 149 |
| 150 SyncSessionSnapshot SyncSession::TakeSnapshot() const { | 150 SyncSessionSnapshot SyncSession::TakeSnapshot() const { |
| 151 syncable::Directory* dir = context_->directory(); | 151 syncable::Directory* dir = context_->directory(); |
| 152 | 152 |
| 153 bool is_share_useable = true; | |
| 154 ModelTypeSet initial_sync_ended; | |
| 155 ProgressMarkerMap download_progress_markers; | 153 ProgressMarkerMap download_progress_markers; |
| 156 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 154 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { |
| 157 ModelType type(ModelTypeFromInt(i)); | 155 ModelType type(ModelTypeFromInt(i)); |
| 158 if (routing_info_.count(type) != 0) { | |
| 159 if (dir->initial_sync_ended_for_type(type)) | |
| 160 initial_sync_ended.Put(type); | |
| 161 else | |
| 162 is_share_useable = false; | |
| 163 } | |
| 164 dir->GetDownloadProgressAsString(type, &download_progress_markers[type]); | 156 dir->GetDownloadProgressAsString(type, &download_progress_markers[type]); |
| 165 } | 157 } |
| 166 | 158 |
| 167 std::vector<int> num_entries_by_type(MODEL_TYPE_COUNT, 0); | 159 std::vector<int> num_entries_by_type(MODEL_TYPE_COUNT, 0); |
| 168 std::vector<int> num_to_delete_entries_by_type(MODEL_TYPE_COUNT, 0); | 160 std::vector<int> num_to_delete_entries_by_type(MODEL_TYPE_COUNT, 0); |
| 169 dir->CollectMetaHandleCounts(&num_entries_by_type, | 161 dir->CollectMetaHandleCounts(&num_entries_by_type, |
| 170 &num_to_delete_entries_by_type); | 162 &num_to_delete_entries_by_type); |
| 171 | 163 |
| 172 SyncSessionSnapshot snapshot( | 164 SyncSessionSnapshot snapshot( |
| 173 status_controller_->model_neutral_state(), | 165 status_controller_->model_neutral_state(), |
| 174 is_share_useable, | |
| 175 initial_sync_ended, | |
| 176 download_progress_markers, | 166 download_progress_markers, |
| 177 delegate_->IsSyncingCurrentlySilenced(), | 167 delegate_->IsSyncingCurrentlySilenced(), |
| 178 status_controller_->num_encryption_conflicts(), | 168 status_controller_->num_encryption_conflicts(), |
| 179 status_controller_->num_hierarchy_conflicts(), | 169 status_controller_->num_hierarchy_conflicts(), |
| 180 status_controller_->num_server_conflicts(), | 170 status_controller_->num_server_conflicts(), |
| 181 source_, | 171 source_, |
| 182 debug_info_sources_list_, | 172 debug_info_sources_list_, |
| 183 context_->notifications_enabled(), | 173 context_->notifications_enabled(), |
| 184 dir->GetEntriesCount(), | 174 dir->GetEntriesCount(), |
| 185 status_controller_->sync_start_time(), | 175 status_controller_->sync_start_time(), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 203 | 193 |
| 204 bool SyncSession::DidReachServer() const { | 194 bool SyncSession::DidReachServer() const { |
| 205 const ModelNeutralState& state = status_controller_->model_neutral_state(); | 195 const ModelNeutralState& state = status_controller_->model_neutral_state(); |
| 206 return state.last_get_key_result >= FIRST_SERVER_RETURN_VALUE || | 196 return state.last_get_key_result >= FIRST_SERVER_RETURN_VALUE || |
| 207 state.last_download_updates_result >= FIRST_SERVER_RETURN_VALUE || | 197 state.last_download_updates_result >= FIRST_SERVER_RETURN_VALUE || |
| 208 state.commit_result >= FIRST_SERVER_RETURN_VALUE; | 198 state.commit_result >= FIRST_SERVER_RETURN_VALUE; |
| 209 } | 199 } |
| 210 | 200 |
| 211 } // namespace sessions | 201 } // namespace sessions |
| 212 } // namespace syncer | 202 } // namespace syncer |
| OLD | NEW |