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