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

Side by Side Diff: sync/internal_api/public/engine/model_safe_worker.cc

Issue 23238005: sync: Remove ModelTypeInvalidationMap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sort entries in gyp files Created 7 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
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/internal_api/public/engine/model_safe_worker.h" 5 #include "sync/internal_api/public/engine/model_safe_worker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 13 matching lines...) Expand all
24 24
25 std::string ModelSafeRoutingInfoToString( 25 std::string ModelSafeRoutingInfoToString(
26 const ModelSafeRoutingInfo& routing_info) { 26 const ModelSafeRoutingInfo& routing_info) {
27 scoped_ptr<base::DictionaryValue> dict( 27 scoped_ptr<base::DictionaryValue> dict(
28 ModelSafeRoutingInfoToValue(routing_info)); 28 ModelSafeRoutingInfoToValue(routing_info));
29 std::string json; 29 std::string json;
30 base::JSONWriter::Write(dict.get(), &json); 30 base::JSONWriter::Write(dict.get(), &json);
31 return json; 31 return json;
32 } 32 }
33 33
34 ModelTypeInvalidationMap ModelSafeRoutingInfoToInvalidationMap(
35 const ModelSafeRoutingInfo& routes,
36 const std::string& payload) {
37 ModelTypeInvalidationMap invalidation_map;
38 for (ModelSafeRoutingInfo::const_iterator i = routes.begin();
39 i != routes.end(); ++i) {
40 invalidation_map[i->first].payload = payload;
41 }
42 return invalidation_map;
43 }
44
45 ModelTypeSet GetRoutingInfoTypes(const ModelSafeRoutingInfo& routing_info) { 34 ModelTypeSet GetRoutingInfoTypes(const ModelSafeRoutingInfo& routing_info) {
46 ModelTypeSet types; 35 ModelTypeSet types;
47 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); 36 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin();
48 it != routing_info.end(); ++it) { 37 it != routing_info.end(); ++it) {
49 types.Put(it->first); 38 types.Put(it->first);
50 } 39 }
51 return types; 40 return types;
52 } 41 }
53 42
54 ModelSafeGroup GetGroupForModelType(const ModelType type, 43 ModelSafeGroup GetGroupForModelType(const ModelType type,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 return; 166 return;
178 DCHECK_EQ(base::MessageLoop::current(), working_loop_); 167 DCHECK_EQ(base::MessageLoop::current(), working_loop_);
179 } 168 }
180 169
181 DCHECK(stopped_); 170 DCHECK(stopped_);
182 base::MessageLoop::current()->RemoveDestructionObserver(this); 171 base::MessageLoop::current()->RemoveDestructionObserver(this);
183 unregister_done_callback.Run(GetModelSafeGroup()); 172 unregister_done_callback.Run(GetModelSafeGroup());
184 } 173 }
185 174
186 } // namespace syncer 175 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/public/engine/model_safe_worker.h ('k') | sync/internal_api/public/engine/model_safe_worker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698