| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/sync/core/read_transaction.h" | |
| 6 | |
| 7 #include "components/sync/syncable/directory.h" | |
| 8 #include "components/sync/syncable/syncable_read_transaction.h" | |
| 9 | |
| 10 namespace syncer { | |
| 11 | |
| 12 ////////////////////////////////////////////////////////////////////////// | |
| 13 // ReadTransaction member definitions | |
| 14 ReadTransaction::ReadTransaction(const tracked_objects::Location& from_here, | |
| 15 UserShare* share) | |
| 16 : BaseTransaction(share), transaction_(NULL), close_transaction_(true) { | |
| 17 transaction_ = | |
| 18 new syncable::ReadTransaction(from_here, share->directory.get()); | |
| 19 } | |
| 20 | |
| 21 ReadTransaction::ReadTransaction(UserShare* share, | |
| 22 syncable::BaseTransaction* trans) | |
| 23 : BaseTransaction(share), transaction_(trans), close_transaction_(false) {} | |
| 24 | |
| 25 ReadTransaction::~ReadTransaction() { | |
| 26 if (close_transaction_) { | |
| 27 delete transaction_; | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 syncable::BaseTransaction* ReadTransaction::GetWrappedTrans() const { | |
| 32 return transaction_; | |
| 33 } | |
| 34 | |
| 35 int64_t ReadTransaction::GetModelVersion(ModelType type) const { | |
| 36 return transaction_->directory()->GetTransactionVersion(type); | |
| 37 } | |
| 38 | |
| 39 void ReadTransaction::GetDataTypeContext( | |
| 40 ModelType type, | |
| 41 sync_pb::DataTypeContext* context) const { | |
| 42 return transaction_->directory()->GetDataTypeContext(transaction_, type, | |
| 43 context); | |
| 44 } | |
| 45 | |
| 46 void ReadTransaction::GetAttachmentIdsToUpload(ModelType type, | |
| 47 AttachmentIdList* ids) const { | |
| 48 DCHECK(ids); | |
| 49 transaction_->directory()->GetAttachmentIdsToUpload(transaction_, type, ids); | |
| 50 } | |
| 51 | |
| 52 std::string ReadTransaction::GetStoreBirthday() const { | |
| 53 return transaction_->directory()->store_birthday(); | |
| 54 } | |
| 55 | |
| 56 } // namespace syncer | |
| OLD | NEW |