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

Unified Diff: sync/syncable/write_transaction.h

Issue 11341048: Populate versions on individual nodes in sync model and native bookmark model. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to head Created 8 years, 1 month 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/syncable/syncable_unittest.cc ('k') | sync/syncable/write_transaction.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « sync/syncable/syncable_unittest.cc ('k') | sync/syncable/write_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698