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

Side by Side Diff: chrome/browser/sync/glue/session_model_associator.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
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 "chrome/browser/sync/glue/session_model_associator.h" 5 #include "chrome/browser/sync/glue/session_model_associator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 14 matching lines...) Expand all
25 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
26 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
27 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
28 #include "chrome/common/url_constants.h" 28 #include "chrome/common/url_constants.h"
29 #include "content/public/browser/navigation_entry.h" 29 #include "content/public/browser/navigation_entry.h"
30 #include "content/public/browser/notification_details.h" 30 #include "content/public/browser/notification_details.h"
31 #include "content/public/browser/notification_service.h" 31 #include "content/public/browser/notification_service.h"
32 #include "sync/api/sync_error.h" 32 #include "sync/api/sync_error.h"
33 #include "sync/api/time.h" 33 #include "sync/api/time.h"
34 #include "sync/internal_api/public/base/model_type.h" 34 #include "sync/internal_api/public/base/model_type.h"
35 #include "sync/internal_api/public/base/model_type_state_map.h" 35 #include "sync/internal_api/public/base/model_type_invalidation_map.h"
36 #include "sync/internal_api/public/read_node.h" 36 #include "sync/internal_api/public/read_node.h"
37 #include "sync/internal_api/public/read_transaction.h" 37 #include "sync/internal_api/public/read_transaction.h"
38 #include "sync/internal_api/public/write_node.h" 38 #include "sync/internal_api/public/write_node.h"
39 #include "sync/internal_api/public/write_transaction.h" 39 #include "sync/internal_api/public/write_transaction.h"
40 #include "sync/protocol/session_specifics.pb.h" 40 #include "sync/protocol/session_specifics.pb.h"
41 #include "sync/syncable/directory.h" 41 #include "sync/syncable/directory.h"
42 #include "sync/syncable/read_transaction.h" 42 #include "sync/syncable/read_transaction.h"
43 #include "sync/syncable/write_transaction.h" 43 #include "sync/syncable/write_transaction.h"
44 #include "sync/util/get_session_name.h" 44 #include "sync/util/get_session_name.h"
45 #include "ui/gfx/favicon_size.h" 45 #include "ui/gfx/favicon_size.h"
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 } 1146 }
1147 1147
1148 void SessionModelAssociator::TabNodePool::FreeTabNode(int64 sync_id) { 1148 void SessionModelAssociator::TabNodePool::FreeTabNode(int64 sync_id) {
1149 // Pool size should always match # of free tab nodes. 1149 // Pool size should always match # of free tab nodes.
1150 DCHECK_LT(tab_pool_fp_, static_cast<int64>(tab_syncid_pool_.size())); 1150 DCHECK_LT(tab_pool_fp_, static_cast<int64>(tab_syncid_pool_.size()));
1151 tab_syncid_pool_[static_cast<size_t>(++tab_pool_fp_)] = sync_id; 1151 tab_syncid_pool_[static_cast<size_t>(++tab_pool_fp_)] = sync_id;
1152 } 1152 }
1153 1153
1154 void SessionModelAssociator::AttemptSessionsDataRefresh() const { 1154 void SessionModelAssociator::AttemptSessionsDataRefresh() const {
1155 DVLOG(1) << "Triggering sync refresh for sessions datatype."; 1155 DVLOG(1) << "Triggering sync refresh for sessions datatype.";
1156 const syncer::ModelType type = syncer::SESSIONS; 1156 const syncer::ModelTypeSet types(syncer::SESSIONS);
1157 syncer::ModelTypeStateMap state_map; 1157 const syncer::ModelTypeInvalidationMap& invalidation_map =
1158 state_map.insert(std::make_pair(type, syncer::InvalidationState())); 1158 ModelTypeSetToInvalidationMap(types, std::string());
1159 content::NotificationService::current()->Notify( 1159 content::NotificationService::current()->Notify(
1160 chrome::NOTIFICATION_SYNC_REFRESH_LOCAL, 1160 chrome::NOTIFICATION_SYNC_REFRESH_LOCAL,
1161 content::Source<Profile>(profile_), 1161 content::Source<Profile>(profile_),
1162 content::Details<const syncer::ModelTypeStateMap>(&state_map)); 1162 content::Details<const syncer::ModelTypeInvalidationMap>(
1163 &invalidation_map));
1163 } 1164 }
1164 1165
1165 bool SessionModelAssociator::GetLocalSession( 1166 bool SessionModelAssociator::GetLocalSession(
1166 const SyncedSession* * local_session) { 1167 const SyncedSession* * local_session) {
1167 DCHECK(CalledOnValidThread()); 1168 DCHECK(CalledOnValidThread());
1168 if (current_machine_tag_.empty()) 1169 if (current_machine_tag_.empty())
1169 return false; 1170 return false;
1170 *local_session = synced_session_tracker_.GetSession(GetCurrentMachineTag()); 1171 *local_session = synced_session_tracker_.GetSession(GetCurrentMachineTag());
1171 return true; 1172 return true;
1172 } 1173 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 1337
1337 bool SessionModelAssociator::CryptoReadyIfNecessary() { 1338 bool SessionModelAssociator::CryptoReadyIfNecessary() {
1338 // We only access the cryptographer while holding a transaction. 1339 // We only access the cryptographer while holding a transaction.
1339 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); 1340 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare());
1340 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes(); 1341 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes();
1341 return !encrypted_types.Has(SESSIONS) || 1342 return !encrypted_types.Has(SESSIONS) ||
1342 sync_service_->IsCryptographerReady(&trans); 1343 sync_service_->IsCryptographerReady(&trans);
1343 } 1344 }
1344 1345
1345 } // namespace browser_sync 1346 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/session_change_processor.cc ('k') | chrome/browser/sync/glue/sync_backend_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698