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

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

Issue 11052007: Rename ModelType/ObjectIdStateMap to InvalidationMap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 2 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/session_state_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 PurgeStaleStates(ModelTypeStateMap* original, 51 void PurgeStaleStates(ModelTypeInvalidationMap* original,
52 const ModelSafeRoutingInfo& routing_info) { 52 const ModelSafeRoutingInfo& routing_info) {
53 std::vector<ModelTypeStateMap::iterator> iterators_to_delete; 53 std::vector<ModelTypeInvalidationMap::iterator> iterators_to_delete;
54 for (ModelTypeStateMap::iterator i = original->begin(); 54 for (ModelTypeInvalidationMap::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<ModelTypeStateMap::iterator>::iterator 61 for (std::vector<ModelTypeInvalidationMap::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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ModelTypeSet initial_sync_ended; 159 ModelTypeSet initial_sync_ended;
160 ModelTypeStateMap download_progress_markers; 160 ModelTypeInvalidationMap download_progress_markers;
161 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { 161 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
162 ModelType type(ModelTypeFromInt(i)); 162 ModelType type(ModelTypeFromInt(i));
163 if (routing_info_.count(type) != 0) { 163 if (routing_info_.count(type) != 0) {
164 if (dir->initial_sync_ended_for_type(type)) 164 if (dir->initial_sync_ended_for_type(type))
165 initial_sync_ended.Put(type); 165 initial_sync_ended.Put(type);
166 else 166 else
167 is_share_useable = false; 167 is_share_useable = false;
168 } 168 }
169 // TODO(dcheng): Is this correct? I'm guessing GetDownloadProgressAsString() 169 // TODO(dcheng): Is this correct? I'm guessing GetDownloadProgressAsString()
170 // shouldn't care about the ack handle... 170 // shouldn't care about the ack handle...
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // with the server. Therefore, we verify no errors and at least one SYNCER_OK. 266 // with the server. Therefore, we verify no errors and at least one SYNCER_OK.
267 return reached_server && !HadErrors(state); 267 return reached_server && !HadErrors(state);
268 } 268 }
269 269
270 void SyncSession::SetFinished() { 270 void SyncSession::SetFinished() {
271 finished_ = true; 271 finished_ = true;
272 } 272 }
273 273
274 } // namespace sessions 274 } // namespace sessions
275 } // namespace syncer 275 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/session_state_unittest.cc ('k') | sync/sessions/sync_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698