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

Side by Side Diff: sync/syncable/write_transaction.h

Issue 11638018: [sync] Componentize sync: Part 5: Eliminate filename collisions in sync.gyp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove comments Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/syncable/syncable_write_transaction.cc ('k') | sync/syncable/write_transaction.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SYNC_SYNCABLE_WRITE_TRANSACTION_H_
6 #define SYNC_SYNCABLE_WRITE_TRANSACTION_H_
7
8 #include "sync/base/sync_export.h"
9 #include "sync/syncable/base_transaction.h"
10 #include "sync/syncable/entry_kernel.h"
11
12 namespace syncer {
13 namespace syncable {
14
15 SYNC_EXPORT extern const int64 kInvalidTransactionVersion;
16
17 // Locks db in constructor, unlocks in destructor.
18 class WriteTransaction : public BaseTransaction {
19 public:
20 WriteTransaction(const tracked_objects::Location& from_here,
21 WriterTag writer, Directory* directory);
22
23 // Constructor used for getting back transaction version after making sync
24 // API changes to one model. If model is changed by the transaction,
25 // the new transaction version of the model and modified nodes will be saved
26 // in |transaction_version| upon destruction of the transaction. If model is
27 // not changed, |transaction_version| will be kInvalidTransactionVersion.
28 WriteTransaction(const tracked_objects::Location& from_here,
29 Directory* directory, int64* transaction_version);
30
31 virtual ~WriteTransaction();
32
33 void SaveOriginal(const EntryKernel* entry);
34
35 protected:
36 // Overridden by tests.
37 virtual void NotifyTransactionComplete(ModelTypeSet models_with_changes);
38
39 private:
40 friend class MutableEntry;
41
42 // Clears |mutations_|.
43 ImmutableEntryKernelMutationMap RecordMutations();
44
45 void UnlockAndNotify(const ImmutableEntryKernelMutationMap& mutations);
46
47 ModelTypeSet NotifyTransactionChangingAndEnding(
48 const ImmutableEntryKernelMutationMap& mutations);
49
50 // Increment versions of the models whose entries are modified and set the
51 // version on the changed entries.
52 void UpdateTransactionVersion(const std::vector<int64>& entry_changed);
53
54 // Only the original fields are filled in until |RecordMutations()|.
55 // We use a mutation map instead of a kernel set to avoid copying.
56 EntryKernelMutationMap mutations_;
57
58 // Stores new transaction version of changed model and nodes if model is
59 // indeed changed. kInvalidTransactionVersion otherwise. Not owned.
60 int64* transaction_version_;
61
62 DISALLOW_COPY_AND_ASSIGN(WriteTransaction);
63 };
64
65 } // namespace syncable
66 } // namespace syncer
67
68 #endif // SYNC_SYNCABLE_WRITE_TRANSACTION_H_
OLDNEW
« no previous file with comments | « sync/syncable/syncable_write_transaction.cc ('k') | sync/syncable/write_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698