Index: sync/syncable/write_transaction.h |
diff --git a/sync/syncable/write_transaction.h b/sync/syncable/write_transaction.h |
index 17264c4c65e3c883439ca84f202c7d1e5b0af24a..6a369638b65674983913f58b8b43456dd2959112 100644 |
--- a/sync/syncable/write_transaction.h |
+++ b/sync/syncable/write_transaction.h |
@@ -11,12 +11,22 @@ |
namespace syncer { |
namespace syncable { |
+extern const int64 kInvalidTransactionVersion; |
+ |
// Locks db in constructor, unlocks in destructor. |
class WriteTransaction : public BaseTransaction { |
public: |
WriteTransaction(const tracked_objects::Location& from_here, |
WriterTag writer, Directory* directory); |
+ // Constructor used for getting back transaction version after making sync |
+ // API changes to one model. If model is changed by the transaction, |
+ // the new transaction version of the model and modified nodes will be saved |
+ // in |transaction_version| upon destruction of the transaction. If model is |
+ // not changed, |transaction_version| will be kInvalidTransactionVersion. |
+ WriteTransaction(const tracked_objects::Location& from_here, |
+ Directory* directory, int64* transaction_version); |
+ |
virtual ~WriteTransaction(); |
void SaveOriginal(const EntryKernel* entry); |
@@ -36,10 +46,18 @@ class WriteTransaction : public BaseTransaction { |
ModelTypeSet NotifyTransactionChangingAndEnding( |
const ImmutableEntryKernelMutationMap& mutations); |
+ // Increment versions of the models whose entries are modified and set the |
+ // version on the changed entries. |
+ void UpdateTransactionVersion(const std::vector<int64>& entry_changed); |
+ |
// Only the original fields are filled in until |RecordMutations()|. |
// We use a mutation map instead of a kernel set to avoid copying. |
EntryKernelMutationMap mutations_; |
+ // Stores new transaction version of changed model and nodes if model is |
+ // indeed changed. kInvalidTransactionVersion otherwise. Not owned. |
+ int64* transaction_version_; |
+ |
DISALLOW_COPY_AND_ASSIGN(WriteTransaction); |
}; |