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