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

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

Issue 7633077: Refactor syncapi.h (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 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_ENGINE_BASE_TRANSACTION_H_
6 #define CHROME_BROWSER_SYNC_ENGINE_BASE_TRANSACTION_H_
7 #pragma once
8
9 #include "chrome/browser/sync/engine/user_share.h"
10 #include "chrome/browser/sync/util/cryptographer.h"
11
12 namespace syncable {
13 class BaseTransaction;
14 class ScopedDirLookup;
15 }
16
17 namespace sync_api {
18
19 // Sync API's BaseTransaction, ReadTransaction, and WriteTransaction allow for
20 // batching of several read and/or write operations. The read and write
21 // operations are performed by creating ReadNode and WriteNode instances using
22 // the transaction. These transaction classes wrap identically named classes in
23 // syncable, and are used in a similar way. Unlike syncable::BaseTransaction,
24 // whose construction requires an explicit syncable::ScopedDirLookup, a sync
25 // API BaseTransaction creates its own ScopedDirLookup implicitly.
26 class BaseTransaction {
27 public:
28 // Provide access to the underlying syncable.h objects from BaseNode.
29 virtual syncable::BaseTransaction* GetWrappedTrans() const = 0;
30 const syncable::ScopedDirLookup& GetLookup() const { return *lookup_; }
31 browser_sync::Cryptographer* GetCryptographer() const {
32 return cryptographer_;
33 }
34
35 protected:
36 // The ScopedDirLookup is created in the constructor and destroyed
37 // in the destructor. Creation of the ScopedDirLookup is not expected
38 // to fail.
39 explicit BaseTransaction(UserShare* share);
40 virtual ~BaseTransaction();
41
42 BaseTransaction() { lookup_= NULL; }
43
44 private:
45 // A syncable ScopedDirLookup, which is the parent of syncable transactions.
46 syncable::ScopedDirLookup* lookup_;
47
48 browser_sync::Cryptographer* cryptographer_;
49
50 DISALLOW_COPY_AND_ASSIGN(BaseTransaction);
51 };
52
53 } // namespace sync_api
54
55 #endif // CHROME_BROWSER_SYNC_ENGINE_BASE_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698