| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef SYNC_INTERNAL_API_PUBLIC_SESSIONS_SYNC_SESSION_SNAPSHOT_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_SESSIONS_SYNC_SESSION_SNAPSHOT_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_SESSIONS_SYNC_SESSION_SNAPSHOT_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_SESSIONS_SYNC_SESSION_SNAPSHOT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // An immutable snapshot of state from a SyncSession. Convenient to use as | 25 // An immutable snapshot of state from a SyncSession. Convenient to use as |
| 26 // part of notifications as it is inherently thread-safe. | 26 // part of notifications as it is inherently thread-safe. |
| 27 // TODO(zea): if copying this all over the place starts getting expensive, | 27 // TODO(zea): if copying this all over the place starts getting expensive, |
| 28 // consider passing around immutable references instead of values. | 28 // consider passing around immutable references instead of values. |
| 29 // Default copy and assign welcome. | 29 // Default copy and assign welcome. |
| 30 class SYNC_EXPORT SyncSessionSnapshot { | 30 class SYNC_EXPORT SyncSessionSnapshot { |
| 31 public: | 31 public: |
| 32 SyncSessionSnapshot(); | 32 SyncSessionSnapshot(); |
| 33 SyncSessionSnapshot( | 33 SyncSessionSnapshot( |
| 34 const ModelNeutralState& model_neutral_state, | 34 const ModelNeutralState& model_neutral_state, |
| 35 bool is_share_usable, | |
| 36 ModelTypeSet initial_sync_ended, | |
| 37 const ProgressMarkerMap& download_progress_markers, | 35 const ProgressMarkerMap& download_progress_markers, |
| 38 bool is_silenced, | 36 bool is_silenced, |
| 39 int num_encryption_conflicts, | 37 int num_encryption_conflicts, |
| 40 int num_hierarchy_conflicts, | 38 int num_hierarchy_conflicts, |
| 41 int num_server_conflicts, | 39 int num_server_conflicts, |
| 42 const SyncSourceInfo& source, | 40 const SyncSourceInfo& source, |
| 43 const std::vector<SyncSourceInfo>& debug_info_sources_list, | 41 const std::vector<SyncSourceInfo>& debug_info_sources_list, |
| 44 bool notifications_enabled, | 42 bool notifications_enabled, |
| 45 size_t num_entries, | 43 size_t num_entries, |
| 46 base::Time sync_start_time, | 44 base::Time sync_start_time, |
| 47 const std::vector<int>& num_entries_by_type, | 45 const std::vector<int>& num_entries_by_type, |
| 48 const std::vector<int>& num_to_delete_entries_by_type); | 46 const std::vector<int>& num_to_delete_entries_by_type); |
| 49 ~SyncSessionSnapshot(); | 47 ~SyncSessionSnapshot(); |
| 50 | 48 |
| 51 // Caller takes ownership of the returned dictionary. | 49 // Caller takes ownership of the returned dictionary. |
| 52 base::DictionaryValue* ToValue() const; | 50 base::DictionaryValue* ToValue() const; |
| 53 | 51 |
| 54 std::string ToString() const; | 52 std::string ToString() const; |
| 55 | 53 |
| 56 ModelNeutralState model_neutral_state() const { | 54 ModelNeutralState model_neutral_state() const { |
| 57 return model_neutral_state_; | 55 return model_neutral_state_; |
| 58 } | 56 } |
| 59 int64 num_server_changes_remaining() const; | 57 int64 num_server_changes_remaining() const; |
| 60 bool is_share_usable() const; | |
| 61 ModelTypeSet initial_sync_ended() const; | |
| 62 const ProgressMarkerMap& download_progress_markers() const; | 58 const ProgressMarkerMap& download_progress_markers() const; |
| 63 bool is_silenced() const; | 59 bool is_silenced() const; |
| 64 int num_encryption_conflicts() const; | 60 int num_encryption_conflicts() const; |
| 65 int num_hierarchy_conflicts() const; | 61 int num_hierarchy_conflicts() const; |
| 66 int num_server_conflicts() const; | 62 int num_server_conflicts() const; |
| 67 SyncSourceInfo source() const; | 63 SyncSourceInfo source() const; |
| 68 const std::vector<SyncSourceInfo>& debug_info_sources_list() const; | 64 const std::vector<SyncSourceInfo>& debug_info_sources_list() const; |
| 69 bool notifications_enabled() const; | 65 bool notifications_enabled() const; |
| 70 size_t num_entries() const; | 66 size_t num_entries() const; |
| 71 base::Time sync_start_time() const; | 67 base::Time sync_start_time() const; |
| 72 const std::vector<int>& num_entries_by_type() const; | 68 const std::vector<int>& num_entries_by_type() const; |
| 73 const std::vector<int>& num_to_delete_entries_by_type() const; | 69 const std::vector<int>& num_to_delete_entries_by_type() const; |
| 74 | 70 |
| 75 // Set iff this snapshot was not built using the default constructor. | 71 // Set iff this snapshot was not built using the default constructor. |
| 76 bool is_initialized() const; | 72 bool is_initialized() const; |
| 77 | 73 |
| 78 private: | 74 private: |
| 79 ModelNeutralState model_neutral_state_; | 75 ModelNeutralState model_neutral_state_; |
| 80 bool is_share_usable_; | |
| 81 ModelTypeSet initial_sync_ended_; | |
| 82 ProgressMarkerMap download_progress_markers_; | 76 ProgressMarkerMap download_progress_markers_; |
| 83 bool is_silenced_; | 77 bool is_silenced_; |
| 84 int num_encryption_conflicts_; | 78 int num_encryption_conflicts_; |
| 85 int num_hierarchy_conflicts_; | 79 int num_hierarchy_conflicts_; |
| 86 int num_server_conflicts_; | 80 int num_server_conflicts_; |
| 87 SyncSourceInfo source_; | 81 SyncSourceInfo source_; |
| 88 std::vector<SyncSourceInfo> debug_info_sources_list_; | 82 std::vector<SyncSourceInfo> debug_info_sources_list_; |
| 89 bool notifications_enabled_; | 83 bool notifications_enabled_; |
| 90 size_t num_entries_; | 84 size_t num_entries_; |
| 91 base::Time sync_start_time_; | 85 base::Time sync_start_time_; |
| 92 | 86 |
| 93 std::vector<int> num_entries_by_type_; | 87 std::vector<int> num_entries_by_type_; |
| 94 std::vector<int> num_to_delete_entries_by_type_; | 88 std::vector<int> num_to_delete_entries_by_type_; |
| 95 | 89 |
| 96 bool is_initialized_; | 90 bool is_initialized_; |
| 97 }; | 91 }; |
| 98 | 92 |
| 99 } // namespace sessions | 93 } // namespace sessions |
| 100 } // namespace syncer | 94 } // namespace syncer |
| 101 | 95 |
| 102 #endif // SYNC_INTERNAL_API_PUBLIC_SESSIONS_SYNC_SESSION_SNAPSHOT_H_ | 96 #endif // SYNC_INTERNAL_API_PUBLIC_SESSIONS_SYNC_SESSION_SNAPSHOT_H_ |
| OLD | NEW |