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

Side by Side Diff: chrome/browser/sync/internal_api/base_transaction.h

Issue 7624009: Original patch by rlarocque@chromium.org at http://codereview.chromium.org/7633077/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows build pt5 Created 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_INTERNAL_API_BASE_TRANSACTION_H_
6 #define CHROME_BROWSER_SYNC_INTERNAL_API_BASE_TRANSACTION_H_
7 #pragma once
8
9 #include "chrome/browser/sync/internal_api/user_share.h"
10
11 #include "chrome/browser/sync/util/cryptographer.h"
12
13 namespace syncable {
14 class BaseTransaction;
15 class ScopedDirLookup;
16 }
17
18 namespace sync_api {
19
20 // Sync API's BaseTransaction, ReadTransaction, and WriteTransaction allow for
21 // batching of several read and/or write operations. The read and write
22 // operations are performed by creating ReadNode and WriteNode instances using
23 // the transaction. These transaction classes wrap identically named classes in
24 // syncable, and are used in a similar way. Unlike syncable::BaseTransaction,
25 // whose construction requires an explicit syncable::ScopedDirLookup, a sync
26 // API BaseTransaction creates its own ScopedDirLookup implicitly.
27 class BaseTransaction {
28 public:
29 // Provide access to the underlying syncable.h objects from BaseNode.
30 virtual syncable::BaseTransaction* GetWrappedTrans() const = 0;
31 const syncable::ScopedDirLookup& GetLookup() const { return *lookup_; }
32 browser_sync::Cryptographer* GetCryptographer() const {
33 return cryptographer_;
34 }
35
36 protected:
37 // The ScopedDirLookup is created in the constructor and destroyed
38 // in the destructor. Creation of the ScopedDirLookup is not expected
39 // to fail.
40 explicit BaseTransaction(UserShare* share);
41 virtual ~BaseTransaction();
42
43 BaseTransaction() { lookup_= NULL; }
44
45 private:
46 // A syncable ScopedDirLookup, which is the parent of syncable transactions.
47 syncable::ScopedDirLookup* lookup_;
48
49 browser_sync::Cryptographer* cryptographer_;
50
51 DISALLOW_COPY_AND_ASSIGN(BaseTransaction);
52 };
53
54 syncable::ModelTypeSet GetEncryptedTypes(
55 const sync_api::BaseTransaction* trans);
56
57 } // namespace sync_api
58
59 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_BASE_TRANSACTION_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/internal_api/base_node.cc ('k') | chrome/browser/sync/internal_api/base_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698