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 #include "sync/api/sync_change.h" | 5 #include "sync/api/sync_change.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 namespace syncer { | 9 namespace syncer { |
10 | 10 |
11 SyncChange::SyncChange() : change_type_(ACTION_INVALID) { | 11 SyncChange::SyncChange() : change_type_(ACTION_INVALID) { |
12 } | 12 } |
13 | 13 |
14 SyncChange::SyncChange(SyncChangeType change_type, const SyncData& sync_data) | 14 SyncChange::SyncChange( |
15 : change_type_(change_type), | 15 const tracked_objects::Location& from_here, |
16 SyncChangeType change_type, | |
17 const SyncData& sync_data) | |
18 : location_(from_here), | |
19 change_type_(change_type), | |
16 sync_data_(sync_data) { | 20 sync_data_(sync_data) { |
17 DCHECK(IsValid()); | 21 DCHECK(IsValid()); |
18 } | 22 } |
19 | 23 |
20 SyncChange::~SyncChange() {} | 24 SyncChange::~SyncChange() {} |
21 | 25 |
22 bool SyncChange::IsValid() const { | 26 bool SyncChange::IsValid() const { |
23 if (change_type_ == ACTION_INVALID || !sync_data_.IsValid()) | 27 if (change_type_ == ACTION_INVALID || !sync_data_.IsValid()) |
24 return false; | 28 return false; |
25 | 29 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 return "ACTION_UPDATE"; | 63 return "ACTION_UPDATE"; |
60 case ACTION_DELETE: | 64 case ACTION_DELETE: |
61 return "ACTION_DELETE"; | 65 return "ACTION_DELETE"; |
62 default: | 66 default: |
63 NOTREACHED(); | 67 NOTREACHED(); |
64 } | 68 } |
65 return std::string(); | 69 return std::string(); |
66 } | 70 } |
67 | 71 |
68 std::string SyncChange::ToString() const { | 72 std::string SyncChange::ToString() const { |
69 return "{ changeType: " + ChangeTypeToString(change_type_) + | 73 return "{ " + location_.ToString() + ", changeType: " + |
rlarocque
2012/07/10 22:09:54
Should there be a "location: " prefix string here?
Nicolas Zea
2012/07/10 22:13:35
I think locations are pretty recognizable enough t
| |
70 ", syncData: " + sync_data_.ToString() + "}"; | 74 ChangeTypeToString(change_type_) + ", syncData: " + |
75 sync_data_.ToString() + "}"; | |
71 } | 76 } |
72 | 77 |
73 void PrintTo(const SyncChange& sync_change, std::ostream* os) { | 78 void PrintTo(const SyncChange& sync_change, std::ostream* os) { |
74 *os << sync_change.ToString(); | 79 *os << sync_change.ToString(); |
75 } | 80 } |
76 | 81 |
77 } // namespace syncer | 82 } // namespace syncer |
OLD | NEW |