| 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 COMPONENTS_SYNC_SESSIONS_SYNC_SESSION_SNAPSHOT_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_CYCLE_SYNC_CYCLE_SNAPSHOT_H_ |
| 6 #define COMPONENTS_SYNC_SESSIONS_SYNC_SESSION_SNAPSHOT_H_ | 6 #define COMPONENTS_SYNC_ENGINE_CYCLE_SYNC_CYCLE_SNAPSHOT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "components/sync/base/model_type.h" | 14 #include "components/sync/base/model_type.h" |
| 15 #include "components/sync/base/progress_marker_map.h" | 15 #include "components/sync/base/progress_marker_map.h" |
| 16 #include "components/sync/sessions/model_neutral_state.h" | 16 #include "components/sync/engine/cycle/model_neutral_state.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class DictionaryValue; | 19 class DictionaryValue; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace syncer { | 22 namespace syncer { |
| 23 namespace sessions { | |
| 24 | 23 |
| 25 // An immutable snapshot of state from a SyncSession. Convenient to use as | 24 // An immutable snapshot of state from a SyncCycle. Convenient to use as |
| 26 // part of notifications as it is inherently thread-safe. | 25 // part of notifications as it is inherently thread-safe. |
| 27 // 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, |
| 28 // consider passing around immutable references instead of values. | 27 // consider passing around immutable references instead of values. |
| 29 // Default copy and assign welcome. | 28 // Default copy and assign welcome. |
| 30 class SyncSessionSnapshot { | 29 class SyncCycleSnapshot { |
| 31 public: | 30 public: |
| 32 SyncSessionSnapshot(); | 31 SyncCycleSnapshot(); |
| 33 SyncSessionSnapshot( | 32 SyncCycleSnapshot( |
| 34 const ModelNeutralState& model_neutral_state, | 33 const ModelNeutralState& model_neutral_state, |
| 35 const ProgressMarkerMap& download_progress_markers, | 34 const ProgressMarkerMap& download_progress_markers, |
| 36 bool is_silenced, | 35 bool is_silenced, |
| 37 int num_encryption_conflicts, | 36 int num_encryption_conflicts, |
| 38 int num_hierarchy_conflicts, | 37 int num_hierarchy_conflicts, |
| 39 int num_server_conflicts, | 38 int num_server_conflicts, |
| 40 bool notifications_enabled, | 39 bool notifications_enabled, |
| 41 size_t num_entries, | 40 size_t num_entries, |
| 42 base::Time sync_start_time, | 41 base::Time sync_start_time, |
| 43 base::Time poll_finish_time, | 42 base::Time poll_finish_time, |
| 44 const std::vector<int>& num_entries_by_type, | 43 const std::vector<int>& num_entries_by_type, |
| 45 const std::vector<int>& num_to_delete_entries_by_type, | 44 const std::vector<int>& num_to_delete_entries_by_type, |
| 46 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource legacy_updates_source); | 45 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource legacy_updates_source); |
| 47 SyncSessionSnapshot(const SyncSessionSnapshot& other); | 46 SyncCycleSnapshot(const SyncCycleSnapshot& other); |
| 48 ~SyncSessionSnapshot(); | 47 ~SyncCycleSnapshot(); |
| 49 | 48 |
| 50 std::unique_ptr<base::DictionaryValue> ToValue() const; | 49 std::unique_ptr<base::DictionaryValue> ToValue() const; |
| 51 | 50 |
| 52 std::string ToString() const; | 51 std::string ToString() const; |
| 53 | 52 |
| 54 ModelNeutralState model_neutral_state() const { return model_neutral_state_; } | 53 ModelNeutralState model_neutral_state() const { return model_neutral_state_; } |
| 55 const ProgressMarkerMap& download_progress_markers() const; | 54 const ProgressMarkerMap& download_progress_markers() const; |
| 56 bool is_silenced() const; | 55 bool is_silenced() const; |
| 57 int num_encryption_conflicts() const; | 56 int num_encryption_conflicts() const; |
| 58 int num_hierarchy_conflicts() const; | 57 int num_hierarchy_conflicts() const; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 84 std::vector<int> num_to_delete_entries_by_type_; | 83 std::vector<int> num_to_delete_entries_by_type_; |
| 85 | 84 |
| 86 // This enum value used to be an important part of the sync protocol, but is | 85 // This enum value used to be an important part of the sync protocol, but is |
| 87 // now deprecated. We continue to use it in the snapshot because there is | 86 // now deprecated. We continue to use it in the snapshot because there is |
| 88 // still some value in displaying it on the about:sync page. | 87 // still some value in displaying it on the about:sync page. |
| 89 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource legacy_updates_source_; | 88 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource legacy_updates_source_; |
| 90 | 89 |
| 91 bool is_initialized_; | 90 bool is_initialized_; |
| 92 }; | 91 }; |
| 93 | 92 |
| 94 } // namespace sessions | |
| 95 } // namespace syncer | 93 } // namespace syncer |
| 96 | 94 |
| 97 #endif // COMPONENTS_SYNC_SESSIONS_SYNC_SESSION_SNAPSHOT_H_ | 95 #endif // COMPONENTS_SYNC_ENGINE_CYCLE_SYNC_CYCLE_SNAPSHOT_H_ |
| OLD | NEW |