Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: sync/notifier/invalidation_util.cc

Issue 10905045: [Sync] Pass ModelTypeSet by value everywhere (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/notifier/invalidation_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « sync/notifier/invalidation_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698