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_API_SYNC_CHANGE_H_ | 5 #ifndef SYNC_API_SYNC_CHANGE_H_ |
6 #define SYNC_API_SYNC_CHANGE_H_ | 6 #define SYNC_API_SYNC_CHANGE_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "sync/api/sync_data.h" | 13 #include "sync/api/sync_data.h" |
14 #include "sync/base/sync_export.h" | 14 #include "sync/base/sync_export.h" |
15 | 15 |
16 namespace syncer { | 16 namespace syncer { |
17 | 17 |
18 // A SyncChange object reflects a change to a piece of synced data. The change | 18 // A SyncChange object reflects a change to a piece of synced data. If the |
19 // can be either a delete, add, or an update. All data relevant to the change | 19 // change is to a a sync entity, the change can be either a delete, add, or an |
maniscalco
2014/03/31 23:59:16
nit: s/to a a/to a/
maniscalco
2014/03/31 23:59:16
nit: s/either //
Nicolas Zea
2014/04/02 18:34:36
Done.
Nicolas Zea
2014/04/02 18:34:36
Done.
| |
20 // update. Context changes are always updates. All data relevant to the change | |
20 // is encapsulated within the SyncChange, which, once created, is immutable. | 21 // is encapsulated within the SyncChange, which, once created, is immutable. |
21 // Note: it is safe and cheap to pass these by value or make copies, as they do | 22 // Note: it is safe and cheap to pass these by value or make copies, as they do |
22 // not create deep copies of their internal data. | 23 // not create deep copies of their internal data. |
23 class SYNC_EXPORT SyncChange { | 24 class SYNC_EXPORT SyncChange { |
24 public: | 25 public: |
25 enum SyncChangeType { | 26 enum SyncChangeType { |
26 ACTION_INVALID, | 27 ACTION_INVALID, |
27 ACTION_ADD, | 28 ACTION_ADD, |
28 ACTION_UPDATE, | 29 ACTION_UPDATE, |
29 ACTION_DELETE, | 30 ACTION_DELETE, |
31 CONTEXT_UPDATE, | |
maniscalco
2014/03/31 23:59:16
It would be helpful to have a comment somewhere (h
maniscalco
2014/03/31 23:59:16
I would have expected this to be called ACTION_CON
Nicolas Zea
2014/04/02 18:34:36
I was kind of thinking to leave the ACTION_ prefix
Nicolas Zea
2014/04/02 18:34:36
Done.
maniscalco
2014/04/02 21:13:09
I'm OK with that distinction. My thinking here wa
| |
30 }; | 32 }; |
31 | 33 |
32 // Default constructor creates an invalid change. | 34 // Default constructor creates an invalid change. |
33 SyncChange(); | 35 SyncChange(); |
34 // Create a new change with the specified sync data. | 36 // Create a new change with the specified sync data. |
35 SyncChange( | 37 SyncChange( |
36 const tracked_objects::Location& from_here, | 38 const tracked_objects::Location& from_here, |
37 SyncChangeType change_type, | 39 SyncChangeType change_type, |
38 const SyncData& sync_data); | 40 const SyncData& sync_data); |
39 ~SyncChange(); | 41 ~SyncChange(); |
(...skipping 29 matching lines...) Expand all Loading... | |
69 // SyncChanges are copied, they copy references to this data. | 71 // SyncChanges are copied, they copy references to this data. |
70 SyncData sync_data_; | 72 SyncData sync_data_; |
71 }; | 73 }; |
72 | 74 |
73 // gmock printer helper. | 75 // gmock printer helper. |
74 SYNC_EXPORT void PrintTo(const SyncChange& sync_change, std::ostream* os); | 76 SYNC_EXPORT void PrintTo(const SyncChange& sync_change, std::ostream* os); |
75 | 77 |
76 } // namespace syncer | 78 } // namespace syncer |
77 | 79 |
78 #endif // SYNC_API_SYNC_CHANGE_H_ | 80 #endif // SYNC_API_SYNC_CHANGE_H_ |
OLD | NEW |