| OLD | NEW |
| (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_WRITE_TRANSACTION_H_ | |
| 6 #define CHROME_BROWSER_SYNC_INTERNAL_API_WRITE_TRANSACTION_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "chrome/browser/sync/internal_api/base_transaction.h" | |
| 11 | |
| 12 namespace syncable { | |
| 13 class BaseTransaction; | |
| 14 class WriteTransaction; | |
| 15 } // namespace syncable | |
| 16 | |
| 17 namespace tracked_objects { | |
| 18 class Location; | |
| 19 } // namespace tracked_objects | |
| 20 | |
| 21 namespace sync_api { | |
| 22 | |
| 23 // Sync API's WriteTransaction is a read/write BaseTransaction. It wraps | |
| 24 // a syncable::WriteTransaction. | |
| 25 // | |
| 26 // NOTE: Only a single model type can be mutated for a given | |
| 27 // WriteTransaction. | |
| 28 class WriteTransaction : public BaseTransaction { | |
| 29 public: | |
| 30 // Start a new read/write transaction. | |
| 31 WriteTransaction(const tracked_objects::Location& from_here, | |
| 32 UserShare* share); | |
| 33 virtual ~WriteTransaction(); | |
| 34 | |
| 35 // Provide access to the syncable.h transaction from the API WriteNode. | |
| 36 virtual syncable::BaseTransaction* GetWrappedTrans() const OVERRIDE; | |
| 37 syncable::WriteTransaction* GetWrappedWriteTrans() { return transaction_; } | |
| 38 | |
| 39 protected: | |
| 40 WriteTransaction() {} | |
| 41 | |
| 42 void SetTransaction(syncable::WriteTransaction* trans) { | |
| 43 transaction_ = trans; | |
| 44 } | |
| 45 | |
| 46 private: | |
| 47 void* operator new(size_t size); // Transaction is meant for stack use only. | |
| 48 | |
| 49 // The underlying syncable object which this class wraps. | |
| 50 syncable::WriteTransaction* transaction_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(WriteTransaction); | |
| 53 }; | |
| 54 | |
| 55 } // namespace sync_api | |
| 56 | |
| 57 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_WRITE_TRANSACTION_H_ | |
| OLD | NEW |