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

Unified Diff: sync/internal_api/write_transaction.cc

Issue 215973007: [Sync] Add plumbing of context from client to server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile Created 6 years, 9 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
« no previous file with comments | « sync/internal_api/public/write_transaction.h ('k') | sync/test/engine/mock_update_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/write_transaction.cc
diff --git a/sync/internal_api/write_transaction.cc b/sync/internal_api/write_transaction.cc
index d33093dac32c01384314f0a7ed07ed14e755419f..b0ed6a2dd2180f30256e172c7e9d3dbf67edf013 100644
--- a/sync/internal_api/write_transaction.cc
+++ b/sync/internal_api/write_transaction.cc
@@ -4,6 +4,7 @@
#include "sync/internal_api/public/write_transaction.h"
+#include "sync/syncable/directory.h"
#include "sync/syncable/syncable_write_transaction.h"
namespace syncer {
@@ -36,4 +37,27 @@ syncable::BaseTransaction* WriteTransaction::GetWrappedTrans() const {
return transaction_;
}
+void WriteTransaction::SetDataTypeContext(ModelType type,
+ const std::string& context) {
+ sync_pb::DataTypeContext local_context;
+ GetDirectory()->GetDataTypeContext(transaction_,
+ type,
+ &local_context);
+ if (local_context.context() == context)
+ return;
+
+ if (!local_context.has_data_type_id()) {
+ local_context.set_data_type_id(
+ syncer::GetSpecificsFieldNumberFromModelType(type));
+ }
+ DCHECK_EQ(syncer::GetSpecificsFieldNumberFromModelType(type),
+ local_context.data_type_id());
+ DCHECK_GE(local_context.version(), 0);
+ local_context.set_version(local_context.version() + 1);
+ local_context.set_context(context);
+ GetDirectory()->SetDataTypeContext(transaction_,
+ type,
+ local_context);
+}
+
} // namespace syncer
« no previous file with comments | « sync/internal_api/public/write_transaction.h ('k') | sync/test/engine/mock_update_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698