| 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 #ifndef COMPONENTS_SYNC_CORE_READ_TRANSACTION_H_ | |
| 6 #define COMPONENTS_SYNC_CORE_READ_TRANSACTION_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 #include <stdint.h> | |
| 10 | |
| 11 #include <string> | |
| 12 | |
| 13 #include "base/compiler_specific.h" | |
| 14 #include "base/macros.h" | |
| 15 #include "components/sync/core/base_transaction.h" | |
| 16 #include "components/sync/model/attachments/attachment_id.h" | |
| 17 | |
| 18 namespace tracked_objects { | |
| 19 class Location; | |
| 20 } // namespace tracked_objects | |
| 21 | |
| 22 namespace sync_pb { | |
| 23 class DataTypeContext; | |
| 24 } | |
| 25 | |
| 26 namespace syncer { | |
| 27 | |
| 28 struct UserShare; | |
| 29 | |
| 30 // Sync API's ReadTransaction is a read-only BaseTransaction. It wraps | |
| 31 // a syncable::ReadTransaction. | |
| 32 class ReadTransaction : public BaseTransaction { | |
| 33 public: | |
| 34 // Start a new read-only transaction on the specified repository. | |
| 35 ReadTransaction(const tracked_objects::Location& from_here, UserShare* share); | |
| 36 | |
| 37 // Resume the middle of a transaction. Will not close transaction. | |
| 38 ReadTransaction(UserShare* share, syncable::BaseTransaction* trans); | |
| 39 | |
| 40 ~ReadTransaction() override; | |
| 41 | |
| 42 // BaseTransaction override. | |
| 43 syncable::BaseTransaction* GetWrappedTrans() const override; | |
| 44 | |
| 45 // Return |transaction_version| of |type| stored in sync directory's | |
| 46 // persisted info. | |
| 47 int64_t GetModelVersion(ModelType type) const; | |
| 48 | |
| 49 // Fills |context| with the datatype context associated with |type|. | |
| 50 void GetDataTypeContext(ModelType type, | |
| 51 sync_pb::DataTypeContext* context) const; | |
| 52 | |
| 53 // Clear |ids| and fill it with the ids of attachments that need to be | |
| 54 // uploaded to the sync server. | |
| 55 void GetAttachmentIdsToUpload(ModelType type, AttachmentIdList* ids) const; | |
| 56 | |
| 57 // Return the current (opaque) store birthday. | |
| 58 std::string GetStoreBirthday() const; | |
| 59 | |
| 60 private: | |
| 61 void* operator new(size_t size); // Transaction is meant for stack use only. | |
| 62 | |
| 63 // The underlying syncable object which this class wraps. | |
| 64 syncable::BaseTransaction* transaction_; | |
| 65 bool close_transaction_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(ReadTransaction); | |
| 68 }; | |
| 69 | |
| 70 } // namespace syncer | |
| 71 | |
| 72 #endif // COMPONENTS_SYNC_CORE_READ_TRANSACTION_H_ | |
| OLD | NEW |