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