| 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/session_state.h" | 5 #include "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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 value->Set("types", syncable::ModelTypePayloadMapToValue(types)); | 43 value->Set("types", syncable::ModelTypePayloadMapToValue(types)); |
| 44 return value; | 44 return value; |
| 45 } | 45 } |
| 46 | 46 |
| 47 SyncerStatus::SyncerStatus() | 47 SyncerStatus::SyncerStatus() |
| 48 : invalid_store(false), | 48 : invalid_store(false), |
| 49 num_successful_commits(0), | 49 num_successful_commits(0), |
| 50 num_successful_bookmark_commits(0), | 50 num_successful_bookmark_commits(0), |
| 51 num_updates_downloaded_total(0), | 51 num_updates_downloaded_total(0), |
| 52 num_tombstone_updates_downloaded_total(0), | 52 num_tombstone_updates_downloaded_total(0), |
| 53 num_reflected_updates_downloaded_total(0), |
| 53 num_local_overwrites(0), | 54 num_local_overwrites(0), |
| 54 num_server_overwrites(0) { | 55 num_server_overwrites(0) { |
| 55 } | 56 } |
| 56 | 57 |
| 57 SyncerStatus::~SyncerStatus() { | 58 SyncerStatus::~SyncerStatus() { |
| 58 } | 59 } |
| 59 | 60 |
| 60 DictionaryValue* SyncerStatus::ToValue() const { | 61 DictionaryValue* SyncerStatus::ToValue() const { |
| 61 DictionaryValue* value = new DictionaryValue(); | 62 DictionaryValue* value = new DictionaryValue(); |
| 62 value->SetBoolean("invalidStore", invalid_store); | 63 value->SetBoolean("invalidStore", invalid_store); |
| 63 value->SetInteger("numSuccessfulCommits", num_successful_commits); | 64 value->SetInteger("numSuccessfulCommits", num_successful_commits); |
| 64 value->SetInteger("numSuccessfulBookmarkCommits", | 65 value->SetInteger("numSuccessfulBookmarkCommits", |
| 65 num_successful_bookmark_commits); | 66 num_successful_bookmark_commits); |
| 66 value->SetInteger("numUpdatesDownloadedTotal", | 67 value->SetInteger("numUpdatesDownloadedTotal", |
| 67 num_updates_downloaded_total); | 68 num_updates_downloaded_total); |
| 68 value->SetInteger("numTombstoneUpdatesDownloadedTotal", | 69 value->SetInteger("numTombstoneUpdatesDownloadedTotal", |
| 69 num_tombstone_updates_downloaded_total); | 70 num_tombstone_updates_downloaded_total); |
| 71 value->SetInteger("numReflectedUpdatesDownloadedTotal", |
| 72 num_reflected_updates_downloaded_total); |
| 70 value->SetInteger("numLocalOverwrites", num_local_overwrites); | 73 value->SetInteger("numLocalOverwrites", num_local_overwrites); |
| 71 value->SetInteger("numServerOverwrites", num_server_overwrites); | 74 value->SetInteger("numServerOverwrites", num_server_overwrites); |
| 72 return value; | 75 return value; |
| 73 } | 76 } |
| 74 | 77 |
| 75 DictionaryValue* DownloadProgressMarkersToValue( | 78 DictionaryValue* DownloadProgressMarkersToValue( |
| 76 const std::string | 79 const std::string |
| 77 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT]) { | 80 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT]) { |
| 78 DictionaryValue* value = new DictionaryValue(); | 81 DictionaryValue* value = new DictionaryValue(); |
| 79 for (int i = syncable::FIRST_REAL_MODEL_TYPE; | 82 for (int i = syncable::FIRST_REAL_MODEL_TYPE; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 106 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT], | 109 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT], |
| 107 bool more_to_sync, | 110 bool more_to_sync, |
| 108 bool is_silenced, | 111 bool is_silenced, |
| 109 int64 unsynced_count, | 112 int64 unsynced_count, |
| 110 int num_encryption_conflicts, | 113 int num_encryption_conflicts, |
| 111 int num_hierarchy_conflicts, | 114 int num_hierarchy_conflicts, |
| 112 int num_simple_conflicts, | 115 int num_simple_conflicts, |
| 113 int num_server_conflicts, | 116 int num_server_conflicts, |
| 114 bool did_commit_items, | 117 bool did_commit_items, |
| 115 const SyncSourceInfo& source, | 118 const SyncSourceInfo& source, |
| 119 bool notifications_enabled, |
| 116 size_t num_entries, | 120 size_t num_entries, |
| 117 base::Time sync_start_time, | 121 base::Time sync_start_time, |
| 118 bool retry_scheduled) | 122 bool retry_scheduled) |
| 119 : syncer_status(syncer_status), | 123 : syncer_status(syncer_status), |
| 120 errors(errors), | 124 errors(errors), |
| 121 num_server_changes_remaining(num_server_changes_remaining), | 125 num_server_changes_remaining(num_server_changes_remaining), |
| 122 is_share_usable(is_share_usable), | 126 is_share_usable(is_share_usable), |
| 123 initial_sync_ended(initial_sync_ended), | 127 initial_sync_ended(initial_sync_ended), |
| 124 download_progress_markers(), | 128 download_progress_markers(), |
| 125 has_more_to_sync(more_to_sync), | 129 has_more_to_sync(more_to_sync), |
| 126 is_silenced(is_silenced), | 130 is_silenced(is_silenced), |
| 127 unsynced_count(unsynced_count), | 131 unsynced_count(unsynced_count), |
| 128 num_encryption_conflicts(num_encryption_conflicts), | 132 num_encryption_conflicts(num_encryption_conflicts), |
| 129 num_hierarchy_conflicts(num_hierarchy_conflicts), | 133 num_hierarchy_conflicts(num_hierarchy_conflicts), |
| 130 num_simple_conflicts(num_simple_conflicts), | 134 num_simple_conflicts(num_simple_conflicts), |
| 131 num_server_conflicts(num_server_conflicts), | 135 num_server_conflicts(num_server_conflicts), |
| 132 did_commit_items(did_commit_items), | 136 did_commit_items(did_commit_items), |
| 133 source(source), | 137 source(source), |
| 138 notifications_enabled(notifications_enabled), |
| 134 num_entries(num_entries), | 139 num_entries(num_entries), |
| 135 sync_start_time(sync_start_time), | 140 sync_start_time(sync_start_time), |
| 136 retry_scheduled(retry_scheduled) { | 141 retry_scheduled(retry_scheduled) { |
| 137 for (int i = syncable::FIRST_REAL_MODEL_TYPE; | 142 for (int i = syncable::FIRST_REAL_MODEL_TYPE; |
| 138 i < syncable::MODEL_TYPE_COUNT; ++i) { | 143 i < syncable::MODEL_TYPE_COUNT; ++i) { |
| 139 const_cast<std::string&>(this->download_progress_markers[i]).assign( | 144 const_cast<std::string&>(this->download_progress_markers[i]).assign( |
| 140 download_progress_markers[i]); | 145 download_progress_markers[i]); |
| 141 } | 146 } |
| 142 } | 147 } |
| 143 | 148 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 163 num_encryption_conflicts); | 168 num_encryption_conflicts); |
| 164 value->SetInteger("numHierarchyConflicts", | 169 value->SetInteger("numHierarchyConflicts", |
| 165 num_hierarchy_conflicts); | 170 num_hierarchy_conflicts); |
| 166 value->SetInteger("numSimpleConflicts", | 171 value->SetInteger("numSimpleConflicts", |
| 167 num_simple_conflicts); | 172 num_simple_conflicts); |
| 168 value->SetInteger("numServerConflicts", | 173 value->SetInteger("numServerConflicts", |
| 169 num_server_conflicts); | 174 num_server_conflicts); |
| 170 value->SetBoolean("didCommitItems", did_commit_items); | 175 value->SetBoolean("didCommitItems", did_commit_items); |
| 171 value->SetInteger("numEntries", num_entries); | 176 value->SetInteger("numEntries", num_entries); |
| 172 value->Set("source", source.ToValue()); | 177 value->Set("source", source.ToValue()); |
| 178 value->SetBoolean("notificationsEnabled", notifications_enabled); |
| 173 return value; | 179 return value; |
| 174 } | 180 } |
| 175 | 181 |
| 176 std::string SyncSessionSnapshot::ToString() const { | 182 std::string SyncSessionSnapshot::ToString() const { |
| 177 scoped_ptr<DictionaryValue> value(ToValue()); | 183 scoped_ptr<DictionaryValue> value(ToValue()); |
| 178 std::string json; | 184 std::string json; |
| 179 base::JSONWriter::WriteWithOptions(value.get(), | 185 base::JSONWriter::WriteWithOptions(value.get(), |
| 180 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 186 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
| 181 &json); | 187 &json); |
| 182 return json; | 188 return json; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 323 |
| 318 PerModelSafeGroupState::PerModelSafeGroupState(bool* dirty_flag) | 324 PerModelSafeGroupState::PerModelSafeGroupState(bool* dirty_flag) |
| 319 : conflict_progress(dirty_flag) { | 325 : conflict_progress(dirty_flag) { |
| 320 } | 326 } |
| 321 | 327 |
| 322 PerModelSafeGroupState::~PerModelSafeGroupState() { | 328 PerModelSafeGroupState::~PerModelSafeGroupState() { |
| 323 } | 329 } |
| 324 | 330 |
| 325 } // namespace sessions | 331 } // namespace sessions |
| 326 } // namespace browser_sync | 332 } // namespace browser_sync |
| OLD | NEW |