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

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

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights 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/status_controller_unittest.cc ('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"
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 // All enabled groups should have a corresponding worker. 42 // All enabled groups should have a corresponding worker.
43 DCHECK(std::includes( 43 DCHECK(std::includes(
44 groups_with_workers.begin(), groups_with_workers.end(), 44 groups_with_workers.begin(), groups_with_workers.end(),
45 enabled_groups.begin(), enabled_groups.end())); 45 enabled_groups.begin(), enabled_groups.end()));
46 } 46 }
47 } 47 }
48 return enabled_groups; 48 return enabled_groups;
49 } 49 }
50 50
51 void PurgeStalePayload(syncable::ModelTypePayloadMap* original, 51 void PurgeStalePayload(syncer::ModelTypePayloadMap* original,
52 const ModelSafeRoutingInfo& routing_info) { 52 const ModelSafeRoutingInfo& routing_info) {
53 std::vector<syncable::ModelTypePayloadMap::iterator> iterators_to_delete; 53 std::vector<syncer::ModelTypePayloadMap::iterator> iterators_to_delete;
54 for (syncable::ModelTypePayloadMap::iterator i = original->begin(); 54 for (syncer::ModelTypePayloadMap::iterator i = original->begin();
55 i != original->end(); ++i) { 55 i != original->end(); ++i) {
56 if (routing_info.end() == routing_info.find(i->first)) { 56 if (routing_info.end() == routing_info.find(i->first)) {
57 iterators_to_delete.push_back(i); 57 iterators_to_delete.push_back(i);
58 } 58 }
59 } 59 }
60 60
61 for (std::vector<syncable::ModelTypePayloadMap::iterator>::iterator 61 for (std::vector<syncer::ModelTypePayloadMap::iterator>::iterator
62 it = iterators_to_delete.begin(); it != iterators_to_delete.end(); 62 it = iterators_to_delete.begin(); it != iterators_to_delete.end();
63 ++it) { 63 ++it) {
64 original->erase(*it); 64 original->erase(*it);
65 } 65 }
66 } 66 }
67 67
68 } // namesepace 68 } // namesepace
69 69
70 SyncSession::SyncSession(SyncSessionContext* context, Delegate* delegate, 70 SyncSession::SyncSession(SyncSessionContext* context, Delegate* delegate,
71 const SyncSourceInfo& source, 71 const SyncSourceInfo& source,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 finished_ = false; 149 finished_ = false;
150 source_.updates_source = 150 source_.updates_source =
151 sync_pb::GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION; 151 sync_pb::GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION;
152 status_controller_.reset(new StatusController(routing_info_)); 152 status_controller_.reset(new StatusController(routing_info_));
153 } 153 }
154 154
155 SyncSessionSnapshot SyncSession::TakeSnapshot() const { 155 SyncSessionSnapshot SyncSession::TakeSnapshot() const {
156 syncable::Directory* dir = context_->directory(); 156 syncable::Directory* dir = context_->directory();
157 157
158 bool is_share_useable = true; 158 bool is_share_useable = true;
159 syncable::ModelTypeSet initial_sync_ended; 159 syncer::ModelTypeSet initial_sync_ended;
160 syncable::ModelTypePayloadMap download_progress_markers; 160 syncer::ModelTypePayloadMap download_progress_markers;
161 for (int i = syncable::FIRST_REAL_MODEL_TYPE; 161 for (int i = syncer::FIRST_REAL_MODEL_TYPE;
162 i < syncable::MODEL_TYPE_COUNT; ++i) { 162 i < syncer::MODEL_TYPE_COUNT; ++i) {
163 syncable::ModelType type(syncable::ModelTypeFromInt(i)); 163 syncer::ModelType type(syncer::ModelTypeFromInt(i));
164 if (routing_info_.count(type) != 0) { 164 if (routing_info_.count(type) != 0) {
165 if (dir->initial_sync_ended_for_type(type)) 165 if (dir->initial_sync_ended_for_type(type))
166 initial_sync_ended.Put(type); 166 initial_sync_ended.Put(type);
167 else 167 else
168 is_share_useable = false; 168 is_share_useable = false;
169 } 169 }
170 dir->GetDownloadProgressAsString(type, &download_progress_markers[type]); 170 dir->GetDownloadProgressAsString(type, &download_progress_markers[type]);
171 } 171 }
172 172
173 return SyncSessionSnapshot( 173 return SyncSessionSnapshot(
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // 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.
270 return reached_server && !HadErrors(state); 270 return reached_server && !HadErrors(state);
271 } 271 }
272 272
273 void SyncSession::SetFinished() { 273 void SyncSession::SetFinished() {
274 finished_ = true; 274 finished_ = true;
275 } 275 }
276 276
277 } // namespace sessions 277 } // namespace sessions
278 } // namespace syncer 278 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/status_controller_unittest.cc ('k') | sync/sessions/sync_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698