| 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 <ostream> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 std::string ObjectIdToString( | 67 std::string ObjectIdToString( |
| 68 const invalidation::ObjectId& object_id) { | 68 const invalidation::ObjectId& object_id) { |
| 69 scoped_ptr<base::DictionaryValue> value(ObjectIdToValue(object_id)); | 69 scoped_ptr<base::DictionaryValue> value(ObjectIdToValue(object_id)); |
| 70 std::string str; | 70 std::string str; |
| 71 base::JSONWriter::Write(value.get(), &str); | 71 base::JSONWriter::Write(value.get(), &str); |
| 72 return str; | 72 return str; |
| 73 } | 73 } |
| 74 | 74 |
| 75 ObjectIdSet ModelTypeSetToObjectIdSet(const ModelTypeSet& model_types) { | 75 ObjectIdSet ModelTypeSetToObjectIdSet(ModelTypeSet model_types) { |
| 76 ObjectIdSet ids; | 76 ObjectIdSet ids; |
| 77 for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { | 77 for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { |
| 78 invalidation::ObjectId model_type_as_id; | 78 invalidation::ObjectId model_type_as_id; |
| 79 if (!RealModelTypeToObjectId(it.Get(), &model_type_as_id)) { | 79 if (!RealModelTypeToObjectId(it.Get(), &model_type_as_id)) { |
| 80 DLOG(WARNING) << "Invalid model type " << it.Get(); | 80 DLOG(WARNING) << "Invalid model type " << it.Get(); |
| 81 continue; | 81 continue; |
| 82 } | 82 } |
| 83 ids.insert(model_type_as_id); | 83 ids.insert(model_type_as_id); |
| 84 } | 84 } |
| 85 return ids; | 85 return ids; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 102 const invalidation::Invalidation& invalidation) { | 102 const invalidation::Invalidation& invalidation) { |
| 103 std::stringstream ss; | 103 std::stringstream ss; |
| 104 ss << "{ "; | 104 ss << "{ "; |
| 105 ss << "object_id: " << ObjectIdToString(invalidation.object_id()) << ", "; | 105 ss << "object_id: " << ObjectIdToString(invalidation.object_id()) << ", "; |
| 106 ss << "version: " << invalidation.version(); | 106 ss << "version: " << invalidation.version(); |
| 107 ss << " }"; | 107 ss << " }"; |
| 108 return ss.str(); | 108 return ss.str(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace syncer | 111 } // namespace syncer |
| OLD | NEW |