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_API_SYNC_CHANGE_H_ | 5 #ifndef COMPONENTS_SYNC_API_SYNC_CHANGE_H_ |
6 #define COMPONENTS_SYNC_API_SYNC_CHANGE_H_ | 6 #define COMPONENTS_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 "components/sync/api/sync_data.h" | 13 #include "components/sync/api/sync_data.h" |
14 #include "components/sync/base/sync_export.h" | |
15 | 14 |
16 namespace syncer { | 15 namespace syncer { |
17 | 16 |
18 // A SyncChange object reflects a change to a piece of synced data. The change | 17 // A SyncChange object reflects a change to a piece of synced data. The change |
19 // can be either a delete, add, or an update. All data relevant to the change | 18 // can be either a delete, add, or an update. All data relevant to the change |
20 // is encapsulated within the SyncChange, which, once created, is immutable. | 19 // 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 | 20 // 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. | 21 // not create deep copies of their internal data. |
23 class SYNC_EXPORT SyncChange { | 22 class SyncChange { |
24 public: | 23 public: |
25 enum SyncChangeType { | 24 enum SyncChangeType { |
26 ACTION_INVALID, | 25 ACTION_INVALID, |
27 ACTION_ADD, | 26 ACTION_ADD, |
28 ACTION_UPDATE, | 27 ACTION_UPDATE, |
29 ACTION_DELETE, | 28 ACTION_DELETE, |
30 }; | 29 }; |
31 | 30 |
32 // Default constructor creates an invalid change. | 31 // Default constructor creates an invalid change. |
33 SyncChange(); | 32 SyncChange(); |
(...skipping 29 matching lines...) Expand all Loading... |
63 tracked_objects::Location location_; | 62 tracked_objects::Location location_; |
64 | 63 |
65 SyncChangeType change_type_; | 64 SyncChangeType change_type_; |
66 | 65 |
67 // An immutable container for the data of this SyncChange. Whenever | 66 // An immutable container for the data of this SyncChange. Whenever |
68 // SyncChanges are copied, they copy references to this data. | 67 // SyncChanges are copied, they copy references to this data. |
69 SyncData sync_data_; | 68 SyncData sync_data_; |
70 }; | 69 }; |
71 | 70 |
72 // gmock printer helper. | 71 // gmock printer helper. |
73 SYNC_EXPORT void PrintTo(const SyncChange& sync_change, std::ostream* os); | 72 void PrintTo(const SyncChange& sync_change, std::ostream* os); |
74 | 73 |
75 } // namespace syncer | 74 } // namespace syncer |
76 | 75 |
77 #endif // COMPONENTS_SYNC_API_SYNC_CHANGE_H_ | 76 #endif // COMPONENTS_SYNC_API_SYNC_CHANGE_H_ |
OLD | NEW |