| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 SYNC_SYNCABLE_SYNCABLE_BASE_TRANSACTION_H_ | 5 #ifndef SYNC_SYNCABLE_SYNCABLE_BASE_TRANSACTION_H_ |
| 6 #define SYNC_SYNCABLE_SYNCABLE_BASE_TRANSACTION_H_ | 6 #define SYNC_SYNCABLE_SYNCABLE_BASE_TRANSACTION_H_ |
| 7 | 7 |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "sync/base/sync_export.h" | |
| 10 #include "sync/syncable/syncable_id.h" | 9 #include "sync/syncable/syncable_id.h" |
| 11 | 10 |
| 12 namespace syncer { | 11 namespace syncer { |
| 13 namespace syncable { | 12 namespace syncable { |
| 14 | 13 |
| 15 class Directory; | 14 class Directory; |
| 16 | 15 |
| 17 // A WriteTransaction has a writer tag describing which body of code is doing | 16 // A WriteTransaction has a writer tag describing which body of code is doing |
| 18 // the write. This is defined up here since WriteTransactionInfo also contains | 17 // the write. This is defined up here since WriteTransactionInfo also contains |
| 19 // one. | 18 // one. |
| 20 enum WriterTag { | 19 enum WriterTag { |
| 21 INVALID, | 20 INVALID, |
| 22 SYNCER, | 21 SYNCER, |
| 23 AUTHWATCHER, | 22 AUTHWATCHER, |
| 24 UNITTEST, | 23 UNITTEST, |
| 25 VACUUM_AFTER_SAVE, | 24 VACUUM_AFTER_SAVE, |
| 26 HANDLE_SAVE_FAILURE, | 25 HANDLE_SAVE_FAILURE, |
| 27 PURGE_ENTRIES, | 26 PURGE_ENTRIES, |
| 28 SYNCAPI, | 27 SYNCAPI, |
| 29 }; | 28 }; |
| 30 | 29 |
| 31 // Make sure to update this if you update WriterTag. | 30 // Make sure to update this if you update WriterTag. |
| 32 std::string WriterTagToString(WriterTag writer_tag); | 31 std::string WriterTagToString(WriterTag writer_tag); |
| 33 | 32 |
| 34 class SYNC_EXPORT_PRIVATE BaseTransaction { | 33 class BaseTransaction { |
| 35 public: | 34 public: |
| 36 inline Directory* directory() const { return directory_; } | 35 inline Directory* directory() const { return directory_; } |
| 37 inline Id root_id() const { return Id(); } | 36 inline Id root_id() const { return Id(); } |
| 38 | 37 |
| 39 virtual ~BaseTransaction(); | 38 virtual ~BaseTransaction(); |
| 40 | 39 |
| 41 // This should be called when a database corruption is detected and there is | 40 // This should be called when a database corruption is detected and there is |
| 42 // no way for us to recover short of wiping the database clean. When this is | 41 // no way for us to recover short of wiping the database clean. When this is |
| 43 // called we set a bool in the transaction. The caller has to unwind the | 42 // called we set a bool in the transaction. The caller has to unwind the |
| 44 // stack. When the destructor for the transaction is called it acts upon the | 43 // stack. When the destructor for the transaction is called it acts upon the |
| (...skipping 30 matching lines...) Expand all Loading... |
| 75 | 74 |
| 76 private: | 75 private: |
| 77 friend class Entry; | 76 friend class Entry; |
| 78 DISALLOW_COPY_AND_ASSIGN(BaseTransaction); | 77 DISALLOW_COPY_AND_ASSIGN(BaseTransaction); |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 } // namespace syncable | 80 } // namespace syncable |
| 82 } // namespace syncer | 81 } // namespace syncer |
| 83 | 82 |
| 84 #endif // SYNC_SYNCABLE_SYNCABLE_BASE_TRANSACTION_H_ | 83 #endif // SYNC_SYNCABLE_SYNCABLE_BASE_TRANSACTION_H_ |
| OLD | NEW |