Chromium Code Reviews| 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_ENGINE_WRITE_TRANSACTION_H_ | |
| 6 #define CHROME_BROWSER_SYNC_ENGINE_WRITE_TRANSACTION_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "chrome/browser/sync/engine/base_transaction.h" | |
| 10 | |
| 11 namespace syncable { | |
| 12 class BaseTransaction; | |
| 13 class WriteTransaction; | |
| 14 } | |
|
tim (not reviewing)
2011/08/15 22:53:55
end namespace decls with // namespace foo
rlarocque
2011/08/16 18:12:46
Done.
| |
| 15 | |
| 16 namespace tracked_objects { | |
| 17 class Location; | |
|
tim (not reviewing)
2011/08/15 22:53:55
same ns comment as before
rlarocque
2011/08/16 18:12:46
Still don't understand it.
On 2011/08/15 22:53:55
| |
| 18 } // namespace tracked_objects | |
| 19 | |
| 20 namespace sync_api { | |
| 21 | |
| 22 // TODO(akalin): Make ReadTransaction/WriteTransaction take a Location | |
|
tim (not reviewing)
2011/08/15 22:53:55
remove todo
rlarocque
2011/08/16 18:12:46
Done.
| |
| 23 // parameter. | |
| 24 | |
| 25 // Sync API's WriteTransaction is a read/write BaseTransaction. It wraps | |
| 26 // a syncable::WriteTransaction. | |
| 27 // | |
| 28 // NOTE: Only a single model type can be mutated for a given | |
| 29 // WriteTransaction. | |
| 30 class WriteTransaction : public BaseTransaction { | |
| 31 public: | |
| 32 // Start a new read/write transaction. | |
| 33 WriteTransaction(const tracked_objects::Location& from_here, | |
| 34 UserShare* share); | |
| 35 virtual ~WriteTransaction(); | |
| 36 | |
| 37 // Provide access to the syncable.h transaction from the API WriteNode. | |
| 38 virtual syncable::BaseTransaction* GetWrappedTrans() const; | |
| 39 syncable::WriteTransaction* GetWrappedWriteTrans() { return transaction_; } | |
| 40 | |
| 41 protected: | |
| 42 WriteTransaction() {} | |
| 43 | |
| 44 void SetTransaction(syncable::WriteTransaction* trans) { | |
| 45 transaction_ = trans; | |
| 46 } | |
| 47 | |
| 48 private: | |
| 49 void* operator new(size_t size); // Transaction is meant for stack use only. | |
| 50 | |
| 51 // The underlying syncable object which this class wraps. | |
| 52 syncable::WriteTransaction* transaction_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(WriteTransaction); | |
| 55 }; | |
| 56 | |
| 57 } // namespace sync_api | |
| 58 | |
| 59 #endif // CHROME_BROWSER_SYNC_ENGINE_WRITE_TRANSACTION_H_ | |
| OLD | NEW |