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

Side by Side Diff: sync/sessions/sync_session.cc

Issue 10690071: [Sync] Move model_type* from syncable/ to base/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/sessions/sync_session.h ('k') | sync/sessions/sync_session_unittest.cc » ('j') | 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/sessions/sync_session.h" 5 #include "sync/sessions/sync_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "sync/internal_api/public/syncable/model_type.h" 11 #include "sync/internal_api/public/base/model_type.h"
12 #include "sync/internal_api/public/engine/model_safe_worker.h"
12 #include "sync/syncable/directory.h" 13 #include "sync/syncable/directory.h"
13 14
14 namespace syncer { 15 namespace syncer {
15 namespace sessions { 16 namespace sessions {
16 17
17 namespace { 18 namespace {
18 19
19 std::set<ModelSafeGroup> ComputeEnabledGroups( 20 std::set<ModelSafeGroup> ComputeEnabledGroups(
20 const ModelSafeRoutingInfo& routing_info, 21 const ModelSafeRoutingInfo& routing_info,
21 const std::vector<ModelSafeWorker*>& workers) { 22 const std::vector<ModelSafeWorker*>& workers) {
(...skipping 18 matching lines...) Expand all
40 } 41 }
41 // All enabled groups should have a corresponding worker. 42 // All enabled groups should have a corresponding worker.
42 DCHECK(std::includes( 43 DCHECK(std::includes(
43 groups_with_workers.begin(), groups_with_workers.end(), 44 groups_with_workers.begin(), groups_with_workers.end(),
44 enabled_groups.begin(), enabled_groups.end())); 45 enabled_groups.begin(), enabled_groups.end()));
45 } 46 }
46 } 47 }
47 return enabled_groups; 48 return enabled_groups;
48 } 49 }
49 50
51 void PurgeStalePayload(syncable::ModelTypePayloadMap* original,
52 const ModelSafeRoutingInfo& routing_info) {
53 std::vector<syncable::ModelTypePayloadMap::iterator> iterators_to_delete;
54 for (syncable::ModelTypePayloadMap::iterator i = original->begin();
55 i != original->end(); ++i) {
56 if (routing_info.end() == routing_info.find(i->first)) {
57 iterators_to_delete.push_back(i);
58 }
59 }
60
61 for (std::vector<syncable::ModelTypePayloadMap::iterator>::iterator
62 it = iterators_to_delete.begin(); it != iterators_to_delete.end();
63 ++it) {
64 original->erase(*it);
65 }
66 }
67
50 } // namesepace 68 } // namesepace
51 69
52 SyncSession::SyncSession(SyncSessionContext* context, Delegate* delegate, 70 SyncSession::SyncSession(SyncSessionContext* context, Delegate* delegate,
53 const SyncSourceInfo& source, 71 const SyncSourceInfo& source,
54 const ModelSafeRoutingInfo& routing_info, 72 const ModelSafeRoutingInfo& routing_info,
55 const std::vector<ModelSafeWorker*>& workers) 73 const std::vector<ModelSafeWorker*>& workers)
56 : context_(context), 74 : context_(context),
57 source_(source), 75 source_(source),
58 write_transaction_(NULL), 76 write_transaction_(NULL),
59 delegate_(delegate), 77 delegate_(delegate),
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // with the server. Therefore, we verify no errors and at least one SYNCER_OK. 269 // with the server. Therefore, we verify no errors and at least one SYNCER_OK.
252 return reached_server && !HadErrors(state); 270 return reached_server && !HadErrors(state);
253 } 271 }
254 272
255 void SyncSession::SetFinished() { 273 void SyncSession::SetFinished() {
256 finished_ = true; 274 finished_ = true;
257 } 275 }
258 276
259 } // namespace sessions 277 } // namespace sessions
260 } // namespace syncer 278 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/sync_session.h ('k') | sync/sessions/sync_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698