Fix import error in mac_platform_backend.py
[chromium-blink-merge.git] / sync / internal_api / public / read_transaction.h
blob02e2633d8ef5f3d73d1e3a8e3b33968d84789a8f
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.
5 #ifndef SYNC_INTERNAL_API_PUBLIC_READ_TRANSACTION_H_
6 #define SYNC_INTERNAL_API_PUBLIC_READ_TRANSACTION_H_
8 #include "base/compiler_specific.h"
9 #include "sync/base/sync_export.h"
10 #include "sync/internal_api/public/base_transaction.h"
12 namespace tracked_objects {
13 class Location;
14 } // namespace tracked_objects
16 namespace syncer {
18 struct UserShare;
20 // Sync API's ReadTransaction is a read-only BaseTransaction. It wraps
21 // a syncable::ReadTransaction.
22 class SYNC_EXPORT ReadTransaction : public BaseTransaction {
23 public:
24 // Start a new read-only transaction on the specified repository.
25 ReadTransaction(const tracked_objects::Location& from_here,
26 UserShare* share);
28 // Resume the middle of a transaction. Will not close transaction.
29 ReadTransaction(UserShare* share, syncable::BaseTransaction* trans);
31 virtual ~ReadTransaction();
33 // BaseTransaction override.
34 virtual syncable::BaseTransaction* GetWrappedTrans() const OVERRIDE;
36 // Return |transaction_version| of |type| stored in sync directory's
37 // persisted info.
38 int64 GetModelVersion(ModelType type);
40 private:
41 void* operator new(size_t size); // Transaction is meant for stack use only.
43 // The underlying syncable object which this class wraps.
44 syncable::BaseTransaction* transaction_;
45 bool close_transaction_;
47 DISALLOW_COPY_AND_ASSIGN(ReadTransaction);
50 } // namespace syncer
52 #endif // SYNC_INTERNAL_API_PUBLIC_READ_TRANSACTION_H_