| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ |
| 7 | 7 |
| 8 #include "sync/internal_api/public/user_share.h" | 8 #include "sync/internal_api/public/user_share.h" |
| 9 | 9 |
| 10 #include "sync/util/cryptographer.h" | 10 #include "sync/util/cryptographer.h" |
| 11 | 11 |
| 12 namespace syncer { | 12 namespace syncer { |
| 13 | 13 |
| 14 namespace syncable { | 14 namespace syncable { |
| 15 class BaseTransaction; | 15 class BaseTransaction; |
| 16 class Directory; | 16 class Directory; |
| 17 } | 17 } |
| 18 | 18 |
| 19 // Sync API's BaseTransaction, ReadTransaction, and WriteTransaction allow for | 19 // Sync API's BaseTransaction, ReadTransaction, and WriteTransaction allow for |
| 20 // batching of several read and/or write operations. The read and write | 20 // batching of several read and/or write operations. The read and write |
| 21 // operations are performed by creating ReadNode and WriteNode instances using | 21 // operations are performed by creating ReadNode and WriteNode instances using |
| 22 // the transaction. These transaction classes wrap identically named classes in | 22 // the transaction. These transaction classes wrap identically named classes in |
| 23 // syncable, and are used in a similar way. Unlike syncable::BaseTransaction, | 23 // syncable, and are used in a similar way. Unlike syncable::BaseTransaction, |
| 24 // whose construction requires an explicit syncable::Directory, a sync | 24 // whose construction requires an explicit syncable::Directory, a sync |
| 25 // API BaseTransaction is created from a UserShare object. | 25 // API BaseTransaction is created from a UserShare object. |
| 26 class BaseTransaction { | 26 class BaseTransaction { |
| 27 public: | 27 public: |
| 28 // Provide access to the underlying syncable objects from BaseNode. | 28 // Provide access to the underlying syncable objects from BaseNode. |
| 29 virtual syncable::BaseTransaction* GetWrappedTrans() const = 0; | 29 virtual syncable::BaseTransaction* GetWrappedTrans() const = 0; |
| 30 syncer::Cryptographer* GetCryptographer() const; | 30 Cryptographer* GetCryptographer() const; |
| 31 | 31 |
| 32 syncable::Directory* GetDirectory() const { | 32 syncable::Directory* GetDirectory() const { |
| 33 return directory_; | 33 return directory_; |
| 34 } | 34 } |
| 35 | 35 |
| 36 protected: | 36 protected: |
| 37 explicit BaseTransaction(UserShare* share); | 37 explicit BaseTransaction(UserShare* share); |
| 38 virtual ~BaseTransaction(); | 38 virtual ~BaseTransaction(); |
| 39 | 39 |
| 40 BaseTransaction() : directory_(NULL) { } | 40 BaseTransaction() : directory_(NULL) { } |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 syncable::Directory* directory_; | 43 syncable::Directory* directory_; |
| 44 | 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(BaseTransaction); | 45 DISALLOW_COPY_AND_ASSIGN(BaseTransaction); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 syncer::ModelTypeSet GetEncryptedTypes(const syncer::BaseTransaction* trans); | 48 ModelTypeSet GetEncryptedTypes(const BaseTransaction* trans); |
| 49 | 49 |
| 50 } // namespace syncer | 50 } // namespace syncer |
| 51 | 51 |
| 52 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ | 52 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ |
| OLD | NEW |