| 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
|
|
|