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