| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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_WRITE_TRANSACTION_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_WRITE_TRANSACTION_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_WRITE_TRANSACTION_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_WRITE_TRANSACTION_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "sync/base/sync_export.h" | 10 #include "sync/base/sync_export.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // if not after transaction is closed. This constructor is used for model | 36 // if not after transaction is closed. This constructor is used for model |
| 37 // types that support embassy data. | 37 // types that support embassy data. |
| 38 WriteTransaction(const tracked_objects::Location& from_here, | 38 WriteTransaction(const tracked_objects::Location& from_here, |
| 39 UserShare* share, int64* transaction_version); | 39 UserShare* share, int64* transaction_version); |
| 40 virtual ~WriteTransaction(); | 40 virtual ~WriteTransaction(); |
| 41 | 41 |
| 42 // Provide access to the syncable transaction from the API WriteNode. | 42 // Provide access to the syncable transaction from the API WriteNode. |
| 43 virtual syncable::BaseTransaction* GetWrappedTrans() const OVERRIDE; | 43 virtual syncable::BaseTransaction* GetWrappedTrans() const OVERRIDE; |
| 44 syncable::WriteTransaction* GetWrappedWriteTrans() { return transaction_; } | 44 syncable::WriteTransaction* GetWrappedWriteTrans() { return transaction_; } |
| 45 | 45 |
| 46 // Set's a |type|'s local context. Does not affect any individual entities. |
| 47 void SetDataTypeContext(ModelType type, const std::string& context); |
| 48 |
| 46 protected: | 49 protected: |
| 47 WriteTransaction() {} | 50 WriteTransaction() {} |
| 48 | 51 |
| 49 void SetTransaction(syncable::WriteTransaction* trans) { | 52 void SetTransaction(syncable::WriteTransaction* trans) { |
| 50 transaction_ = trans; | 53 transaction_ = trans; |
| 51 } | 54 } |
| 52 | 55 |
| 53 private: | 56 private: |
| 54 void* operator new(size_t size); // Transaction is meant for stack use only. | 57 void* operator new(size_t size); // Transaction is meant for stack use only. |
| 55 | 58 |
| 56 // The underlying syncable object which this class wraps. | 59 // The underlying syncable object which this class wraps. |
| 57 syncable::WriteTransaction* transaction_; | 60 syncable::WriteTransaction* transaction_; |
| 58 | 61 |
| 59 DISALLOW_COPY_AND_ASSIGN(WriteTransaction); | 62 DISALLOW_COPY_AND_ASSIGN(WriteTransaction); |
| 60 }; | 63 }; |
| 61 | 64 |
| 62 } // namespace syncer | 65 } // namespace syncer |
| 63 | 66 |
| 64 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_TRANSACTION_H_ | 67 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_TRANSACTION_H_ |
| OLD | NEW |