| 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 #ifndef COMPONENTS_SYNC_CORE_WRITE_TRANSACTION_H_ | 5 #ifndef COMPONENTS_SYNC_CORE_WRITE_TRANSACTION_H_ |
| 6 #define COMPONENTS_SYNC_CORE_WRITE_TRANSACTION_H_ | 6 #define COMPONENTS_SYNC_CORE_WRITE_TRANSACTION_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "components/sync/api/sync_change_processor.h" | 15 #include "components/sync/api/sync_change_processor.h" |
| 16 #include "components/sync/base/sync_export.h" | |
| 17 #include "components/sync/core/base_transaction.h" | 16 #include "components/sync/core/base_transaction.h" |
| 18 | 17 |
| 19 namespace tracked_objects { | 18 namespace tracked_objects { |
| 20 class Location; | 19 class Location; |
| 21 } // namespace tracked_objects | 20 } // namespace tracked_objects |
| 22 | 21 |
| 23 namespace syncer { | 22 namespace syncer { |
| 24 | 23 |
| 25 namespace syncable { | 24 namespace syncable { |
| 26 class BaseTransaction; | 25 class BaseTransaction; |
| 27 class WriteTransaction; | 26 class WriteTransaction; |
| 28 } // namespace syncable | 27 } // namespace syncable |
| 29 | 28 |
| 30 // Sync API's WriteTransaction is a read/write BaseTransaction. It wraps | 29 // Sync API's WriteTransaction is a read/write BaseTransaction. It wraps |
| 31 // a syncable::WriteTransaction. | 30 // a syncable::WriteTransaction. |
| 32 // | 31 // |
| 33 // NOTE: Only a single model type can be mutated for a given | 32 // NOTE: Only a single model type can be mutated for a given |
| 34 // WriteTransaction. | 33 // WriteTransaction. |
| 35 class SYNC_EXPORT WriteTransaction : public BaseTransaction { | 34 class WriteTransaction : public BaseTransaction { |
| 36 public: | 35 public: |
| 37 // Start a new read/write transaction. | 36 // Start a new read/write transaction. |
| 38 WriteTransaction(const tracked_objects::Location& from_here, | 37 WriteTransaction(const tracked_objects::Location& from_here, |
| 39 UserShare* share); | 38 UserShare* share); |
| 40 // |transaction_version| stores updated model and nodes version if model | 39 // |transaction_version| stores updated model and nodes version if model |
| 41 // is changed by the transaction, or syncer::syncable::kInvalidTransaction | 40 // is changed by the transaction, or syncer::syncable::kInvalidTransaction |
| 42 // if not after transaction is closed. This constructor is used for model | 41 // if not after transaction is closed. This constructor is used for model |
| 43 // types that support embassy data. | 42 // types that support embassy data. |
| 44 WriteTransaction(const tracked_objects::Location& from_here, | 43 WriteTransaction(const tracked_objects::Location& from_here, |
| 45 UserShare* share, | 44 UserShare* share, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 74 | 73 |
| 75 // The underlying syncable object which this class wraps. | 74 // The underlying syncable object which this class wraps. |
| 76 syncable::WriteTransaction* transaction_; | 75 syncable::WriteTransaction* transaction_; |
| 77 | 76 |
| 78 DISALLOW_COPY_AND_ASSIGN(WriteTransaction); | 77 DISALLOW_COPY_AND_ASSIGN(WriteTransaction); |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 } // namespace syncer | 80 } // namespace syncer |
| 82 | 81 |
| 83 #endif // COMPONENTS_SYNC_CORE_WRITE_TRANSACTION_H_ | 82 #endif // COMPONENTS_SYNC_CORE_WRITE_TRANSACTION_H_ |
| OLD | NEW |