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

Side by Side Diff: sync/internal_api/public/write_transaction.h

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « sync/internal_api/public/write_node.h ('k') | sync/internal_api/read_node.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_INTERNAL_API_PUBLIC_WRITE_TRANSACTION_H_
6 #define SYNC_INTERNAL_API_PUBLIC_WRITE_TRANSACTION_H_
7
8 #include <stddef.h>
9 #include <stdint.h>
10
11 #include <string>
12
13 #include "base/compiler_specific.h"
14 #include "base/macros.h"
15 #include "sync/api/sync_change_processor.h"
16 #include "sync/base/sync_export.h"
17 #include "sync/internal_api/public/base_transaction.h"
18
19 namespace tracked_objects {
20 class Location;
21 } // namespace tracked_objects
22
23 namespace syncer {
24
25 namespace syncable {
26 class BaseTransaction;
27 class WriteTransaction;
28 } // namespace syncable
29
30 // Sync API's WriteTransaction is a read/write BaseTransaction. It wraps
31 // a syncable::WriteTransaction.
32 //
33 // NOTE: Only a single model type can be mutated for a given
34 // WriteTransaction.
35 class SYNC_EXPORT WriteTransaction : public BaseTransaction {
36 public:
37 // Start a new read/write transaction.
38 WriteTransaction(const tracked_objects::Location& from_here,
39 UserShare* share);
40 // |transaction_version| stores updated model and nodes version if model
41 // is changed by the transaction, or syncer::syncable::kInvalidTransaction
42 // if not after transaction is closed. This constructor is used for model
43 // types that support embassy data.
44 WriteTransaction(const tracked_objects::Location& from_here,
45 UserShare* share,
46 int64_t* transaction_version);
47 ~WriteTransaction() override;
48
49 // Provide access to the syncable transaction from the API WriteNode.
50 syncable::BaseTransaction* GetWrappedTrans() const override;
51 syncable::WriteTransaction* GetWrappedWriteTrans() { return transaction_; }
52
53 // Set's a |type|'s local context. |refresh_status| controls whether
54 // a datatype refresh is performed (clearing the progress marker token and
55 // setting the version of all synced entities to 1).
56 void SetDataTypeContext(
57 ModelType type,
58 syncer::SyncChangeProcessor::ContextRefreshStatus refresh_status,
59 const std::string& context);
60
61 // Update all entries that refer to |attachment_id| indicating that
62 // |attachment_id| has been uploaded to the sync server.
63 void UpdateEntriesMarkAttachmentAsOnServer(const AttachmentId& attachment_id);
64
65 protected:
66 WriteTransaction() {}
67
68 void SetTransaction(syncable::WriteTransaction* trans) {
69 transaction_ = trans;
70 }
71
72 private:
73 void* operator new(size_t size); // Transaction is meant for stack use only.
74
75 // The underlying syncable object which this class wraps.
76 syncable::WriteTransaction* transaction_;
77
78 DISALLOW_COPY_AND_ASSIGN(WriteTransaction);
79 };
80
81 } // namespace syncer
82
83 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_TRANSACTION_H_
OLDNEW
« no previous file with comments | « sync/internal_api/public/write_node.h ('k') | sync/internal_api/read_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698