| 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 "chrome/browser/sync/sessions/session_state.h" | 5 #include "chrome/browser/sync/sessions/session_state.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 value->SetInteger("consecutiveTransientErrorCommits", | 105 value->SetInteger("consecutiveTransientErrorCommits", |
| 106 consecutive_transient_error_commits); | 106 consecutive_transient_error_commits); |
| 107 value->SetInteger("consecutiveErrors", consecutive_errors); | 107 value->SetInteger("consecutiveErrors", consecutive_errors); |
| 108 return value; | 108 return value; |
| 109 } | 109 } |
| 110 | 110 |
| 111 SyncSessionSnapshot::SyncSessionSnapshot( | 111 SyncSessionSnapshot::SyncSessionSnapshot( |
| 112 const SyncerStatus& syncer_status, | 112 const SyncerStatus& syncer_status, |
| 113 const ErrorCounters& errors, | 113 const ErrorCounters& errors, |
| 114 int64 num_server_changes_remaining, | 114 int64 num_server_changes_remaining, |
| 115 bool is_share_usable, | |
| 116 syncable::ModelTypeSet initial_sync_ended, | 115 syncable::ModelTypeSet initial_sync_ended, |
| 117 const std::string | 116 const std::string |
| 118 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT], | 117 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT], |
| 119 bool more_to_sync, | 118 bool more_to_sync, |
| 120 bool is_silenced, | 119 bool is_silenced, |
| 121 int64 unsynced_count, | 120 int64 unsynced_count, |
| 122 int num_blocking_conflicting_updates, | 121 int num_blocking_conflicting_updates, |
| 123 int num_conflicting_updates, | 122 int num_conflicting_updates, |
| 124 bool did_commit_items, | 123 bool did_commit_items, |
| 125 const SyncSourceInfo& source, | 124 const SyncSourceInfo& source, |
| 126 size_t num_entries, | 125 size_t num_entries, |
| 127 base::Time sync_start_time, | 126 base::Time sync_start_time, |
| 128 bool retry_scheduled) | 127 bool retry_scheduled) |
| 129 : syncer_status(syncer_status), | 128 : syncer_status(syncer_status), |
| 130 errors(errors), | 129 errors(errors), |
| 131 num_server_changes_remaining(num_server_changes_remaining), | 130 num_server_changes_remaining(num_server_changes_remaining), |
| 132 is_share_usable(is_share_usable), | |
| 133 initial_sync_ended(initial_sync_ended), | 131 initial_sync_ended(initial_sync_ended), |
| 134 download_progress_markers(), | 132 download_progress_markers(), |
| 135 has_more_to_sync(more_to_sync), | 133 has_more_to_sync(more_to_sync), |
| 136 is_silenced(is_silenced), | 134 is_silenced(is_silenced), |
| 137 unsynced_count(unsynced_count), | 135 unsynced_count(unsynced_count), |
| 138 num_blocking_conflicting_updates(num_blocking_conflicting_updates), | 136 num_blocking_conflicting_updates(num_blocking_conflicting_updates), |
| 139 num_conflicting_updates(num_conflicting_updates), | 137 num_conflicting_updates(num_conflicting_updates), |
| 140 did_commit_items(did_commit_items), | 138 did_commit_items(did_commit_items), |
| 141 source(source), | 139 source(source), |
| 142 num_entries(num_entries), | 140 num_entries(num_entries), |
| 143 sync_start_time(sync_start_time), | 141 sync_start_time(sync_start_time), |
| 144 retry_scheduled(retry_scheduled) { | 142 retry_scheduled(retry_scheduled) { |
| 145 for (int i = syncable::FIRST_REAL_MODEL_TYPE; | 143 for (int i = syncable::FIRST_REAL_MODEL_TYPE; |
| 146 i < syncable::MODEL_TYPE_COUNT; ++i) { | 144 i < syncable::MODEL_TYPE_COUNT; ++i) { |
| 147 const_cast<std::string&>(this->download_progress_markers[i]).assign( | 145 const_cast<std::string&>(this->download_progress_markers[i]).assign( |
| 148 download_progress_markers[i]); | 146 download_progress_markers[i]); |
| 149 } | 147 } |
| 150 } | 148 } |
| 151 | 149 |
| 152 SyncSessionSnapshot::~SyncSessionSnapshot() {} | 150 SyncSessionSnapshot::~SyncSessionSnapshot() {} |
| 153 | 151 |
| 154 DictionaryValue* SyncSessionSnapshot::ToValue() const { | 152 DictionaryValue* SyncSessionSnapshot::ToValue() const { |
| 155 DictionaryValue* value = new DictionaryValue(); | 153 DictionaryValue* value = new DictionaryValue(); |
| 156 value->Set("syncerStatus", syncer_status.ToValue()); | 154 value->Set("syncerStatus", syncer_status.ToValue()); |
| 157 value->Set("errors", errors.ToValue()); | 155 value->Set("errors", errors.ToValue()); |
| 158 // We don't care too much if we lose precision here. | 156 // We don't care too much if we lose precision here. |
| 159 value->SetInteger("numServerChangesRemaining", | 157 value->SetInteger("numServerChangesRemaining", |
| 160 static_cast<int>(num_server_changes_remaining)); | 158 static_cast<int>(num_server_changes_remaining)); |
| 161 value->SetBoolean("isShareUsable", is_share_usable); | |
| 162 value->Set("initialSyncEnded", | 159 value->Set("initialSyncEnded", |
| 163 syncable::ModelTypeSetToValue(initial_sync_ended)); | 160 syncable::ModelTypeSetToValue(initial_sync_ended)); |
| 164 value->Set("downloadProgressMarkers", | 161 value->Set("downloadProgressMarkers", |
| 165 DownloadProgressMarkersToValue(download_progress_markers)); | 162 DownloadProgressMarkersToValue(download_progress_markers)); |
| 166 value->SetBoolean("hasMoreToSync", has_more_to_sync); | 163 value->SetBoolean("hasMoreToSync", has_more_to_sync); |
| 167 value->SetBoolean("isSilenced", is_silenced); | 164 value->SetBoolean("isSilenced", is_silenced); |
| 168 // We don't care too much if we lose precision here, also. | 165 // We don't care too much if we lose precision here, also. |
| 169 value->SetInteger("unsyncedCount", | 166 value->SetInteger("unsyncedCount", |
| 170 static_cast<int>(unsynced_count)); | 167 static_cast<int>(unsynced_count)); |
| 171 value->SetInteger("numBlockingConflictingUpdates", | 168 value->SetInteger("numBlockingConflictingUpdates", |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 390 |
| 394 PerModelSafeGroupState::PerModelSafeGroupState(bool* dirty_flag) | 391 PerModelSafeGroupState::PerModelSafeGroupState(bool* dirty_flag) |
| 395 : conflict_progress(dirty_flag) { | 392 : conflict_progress(dirty_flag) { |
| 396 } | 393 } |
| 397 | 394 |
| 398 PerModelSafeGroupState::~PerModelSafeGroupState() { | 395 PerModelSafeGroupState::~PerModelSafeGroupState() { |
| 399 } | 396 } |
| 400 | 397 |
| 401 } // namespace sessions | 398 } // namespace sessions |
| 402 } // namespace browser_sync | 399 } // namespace browser_sync |
| OLD | NEW |