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/notifier/invalidation_util.h" | 5 #include "sync/notifier/invalidation_util.h" |
6 | 6 |
| 7 #include <ostream> |
7 #include <sstream> | 8 #include <sstream> |
8 | 9 |
9 #include "google/cacheinvalidation/include/types.h" | 10 #include "google/cacheinvalidation/include/types.h" |
10 #include "google/cacheinvalidation/types.pb.h" | 11 #include "google/cacheinvalidation/types.pb.h" |
11 | 12 |
| 13 namespace invalidation { |
| 14 void PrintTo(const invalidation::ObjectId& id, std::ostream* os) { |
| 15 *os << syncer::ObjectIdToString(id); |
| 16 } |
| 17 } // namespace invalidation |
| 18 |
12 namespace syncer { | 19 namespace syncer { |
13 | 20 |
14 bool ObjectIdLessThan::operator()(const invalidation::ObjectId& lhs, | 21 bool ObjectIdLessThan::operator()(const invalidation::ObjectId& lhs, |
15 const invalidation::ObjectId& rhs) const { | 22 const invalidation::ObjectId& rhs) const { |
16 return (lhs.source() < rhs.source()) || | 23 return (lhs.source() < rhs.source()) || |
17 (lhs.source() == rhs.source() && lhs.name() < rhs.name()); | 24 (lhs.source() == rhs.source() && lhs.name() < rhs.name()); |
18 } | 25 } |
19 | 26 |
20 bool RealModelTypeToObjectId(ModelType model_type, | 27 bool RealModelTypeToObjectId(ModelType model_type, |
21 invalidation::ObjectId* object_id) { | 28 invalidation::ObjectId* object_id) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 const invalidation::Invalidation& invalidation) { | 80 const invalidation::Invalidation& invalidation) { |
74 std::stringstream ss; | 81 std::stringstream ss; |
75 ss << "{ "; | 82 ss << "{ "; |
76 ss << "object_id: " << ObjectIdToString(invalidation.object_id()) << ", "; | 83 ss << "object_id: " << ObjectIdToString(invalidation.object_id()) << ", "; |
77 ss << "version: " << invalidation.version(); | 84 ss << "version: " << invalidation.version(); |
78 ss << " }"; | 85 ss << " }"; |
79 return ss.str(); | 86 return ss.str(); |
80 } | 87 } |
81 | 88 |
82 } // namespace syncer | 89 } // namespace syncer |
OLD | NEW |