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

Unified Diff: chrome/browser/sync/glue/session_model_associator.cc

Issue 10966002: Add cache_guid accessor to UserShare (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/session_model_associator.cc
diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc
index 0457f7241c4dd6511e1f02ad88a3212fd33c60ea..702304543cf6b339ac9a214ee62eab3e275c4d04 100644
--- a/chrome/browser/sync/glue/session_model_associator.cc
+++ b/chrome/browser/sync/glue/session_model_associator.cc
@@ -34,12 +34,10 @@
#include "sync/internal_api/public/base/model_type_state_map.h"
#include "sync/internal_api/public/read_node.h"
#include "sync/internal_api/public/read_transaction.h"
+#include "sync/internal_api/public/user_share.h"
#include "sync/internal_api/public/write_node.h"
#include "sync/internal_api/public/write_transaction.h"
#include "sync/protocol/session_specifics.pb.h"
-#include "sync/syncable/directory.h"
-#include "sync/syncable/read_transaction.h"
-#include "sync/syncable/write_transaction.h"
#include "sync/util/get_session_name.h"
#include "sync/util/time.h"
#include "ui/gfx/favicon_size.h"
@@ -763,7 +761,7 @@ syncer::SyncError SessionModelAssociator::AssociateModels() {
// Make sure we have a machine tag.
if (current_machine_tag_.empty()) {
- InitializeCurrentMachineTag(&trans);
+ InitializeCurrentMachineTag(sync_service_->GetUserShare());
// The session name is retrieved asynchronously so it might not come back
// for the writing of the session. However, we write to the session often
// enough (on every navigation) that we'll pick it up quickly.
@@ -838,7 +836,7 @@ syncer::SyncError SessionModelAssociator::DisassociateModels() {
}
void SessionModelAssociator::InitializeCurrentMachineTag(
- syncer::WriteTransaction* trans) {
+ syncer::UserShare* share) {
DCHECK(CalledOnValidThread());
DCHECK(current_machine_tag_.empty());
std::string persisted_guid;
@@ -849,8 +847,6 @@ void SessionModelAssociator::InitializeCurrentMachineTag(
DVLOG(1) << "Restoring persisted session sync guid: "
<< persisted_guid;
} else {
- syncer::syncable::Directory* dir =
- trans->GetWrappedWriteTrans()->directory();
current_machine_tag_ = "session_sync";
#if defined(OS_ANDROID)
const std::string android_id = syncer::internal::GetAndroidId();
@@ -858,9 +854,9 @@ void SessionModelAssociator::InitializeCurrentMachineTag(
// are supposed to be fixed as of Gingerbread, but if it happens we fall
// back to use the same GUID generation as on other platforms.
current_machine_tag_.append(android_id.empty() ?
- dir->cache_guid() : android_id);
+ share->cache_guid() : android_id);
#else
- current_machine_tag_.append(dir->cache_guid());
+ current_machine_tag_.append(share->cache_guid());
#endif
DVLOG(1) << "Creating session sync guid: " << current_machine_tag_;
if (pref_service_)

Powered by Google App Engine
This is Rietveld 408576698