| 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_DIRECTORY_CHANGE_DELEGATE_H_ | 5 #ifndef COMPONENTS_SYNC_SYNCABLE_DIRECTORY_CHANGE_DELEGATE_H_ |
| 6 #define COMPONENTS_SYNC_SYNCABLE_DIRECTORY_CHANGE_DELEGATE_H_ | 6 #define COMPONENTS_SYNC_SYNCABLE_DIRECTORY_CHANGE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "components/sync/base/model_type.h" | 12 #include "components/sync/base/model_type.h" |
| 13 #include "components/sync/base/sync_export.h" | |
| 14 #include "components/sync/syncable/write_transaction_info.h" | 13 #include "components/sync/syncable/write_transaction_info.h" |
| 15 | 14 |
| 16 namespace syncer { | 15 namespace syncer { |
| 17 namespace syncable { | 16 namespace syncable { |
| 18 | 17 |
| 19 // This is an interface for listening to directory change events, triggered by | 18 // This is an interface for listening to directory change events, triggered by |
| 20 // the releasing of the syncable transaction. The delegate performs work to | 19 // the releasing of the syncable transaction. The delegate performs work to |
| 21 // 1. Calculate changes, depending on the source of the transaction | 20 // 1. Calculate changes, depending on the source of the transaction |
| 22 // (HandleCalculateChangesChangeEventFromSyncer/Syncapi). | 21 // (HandleCalculateChangesChangeEventFromSyncer/Syncapi). |
| 23 // 2. Perform final work while the transaction is held | 22 // 2. Perform final work while the transaction is held |
| 24 // (HandleTransactionEndingChangeEvent). | 23 // (HandleTransactionEndingChangeEvent). |
| 25 // 3. Perform any work that should be done after the transaction is released. | 24 // 3. Perform any work that should be done after the transaction is released. |
| 26 // (HandleTransactionCompleteChangeEvent). | 25 // (HandleTransactionCompleteChangeEvent). |
| 27 // | 26 // |
| 28 // Note that these methods may be called on *any* thread. | 27 // Note that these methods may be called on *any* thread. |
| 29 class SYNC_EXPORT DirectoryChangeDelegate { | 28 class DirectoryChangeDelegate { |
| 30 public: | 29 public: |
| 31 // Returns the handles of changed entries in |entry_changed|. | 30 // Returns the handles of changed entries in |entry_changed|. |
| 32 virtual void HandleCalculateChangesChangeEventFromSyncApi( | 31 virtual void HandleCalculateChangesChangeEventFromSyncApi( |
| 33 const ImmutableWriteTransactionInfo& write_transaction_info, | 32 const ImmutableWriteTransactionInfo& write_transaction_info, |
| 34 BaseTransaction* trans, | 33 BaseTransaction* trans, |
| 35 std::vector<int64_t>* entries_changed) = 0; | 34 std::vector<int64_t>* entries_changed) = 0; |
| 36 // Returns the handles of changed entries in |entry_changed|. | 35 // Returns the handles of changed entries in |entry_changed|. |
| 37 virtual void HandleCalculateChangesChangeEventFromSyncer( | 36 virtual void HandleCalculateChangesChangeEventFromSyncer( |
| 38 const ImmutableWriteTransactionInfo& write_transaction_info, | 37 const ImmutableWriteTransactionInfo& write_transaction_info, |
| 39 BaseTransaction* trans, | 38 BaseTransaction* trans, |
| 40 std::vector<int64_t>* entries_changed) = 0; | 39 std::vector<int64_t>* entries_changed) = 0; |
| 41 // Must return the set of all ModelTypes that were modified in the | 40 // Must return the set of all ModelTypes that were modified in the |
| 42 // transaction. | 41 // transaction. |
| 43 virtual ModelTypeSet HandleTransactionEndingChangeEvent( | 42 virtual ModelTypeSet HandleTransactionEndingChangeEvent( |
| 44 const ImmutableWriteTransactionInfo& write_transaction_info, | 43 const ImmutableWriteTransactionInfo& write_transaction_info, |
| 45 BaseTransaction* trans) = 0; | 44 BaseTransaction* trans) = 0; |
| 46 virtual void HandleTransactionCompleteChangeEvent( | 45 virtual void HandleTransactionCompleteChangeEvent( |
| 47 ModelTypeSet models_with_changes) = 0; | 46 ModelTypeSet models_with_changes) = 0; |
| 48 | 47 |
| 49 protected: | 48 protected: |
| 50 virtual ~DirectoryChangeDelegate() {} | 49 virtual ~DirectoryChangeDelegate() {} |
| 51 }; | 50 }; |
| 52 | 51 |
| 53 } // namespace syncable | 52 } // namespace syncable |
| 54 } // namespace syncer | 53 } // namespace syncer |
| 55 | 54 |
| 56 #endif // COMPONENTS_SYNC_SYNCABLE_DIRECTORY_CHANGE_DELEGATE_H_ | 55 #endif // COMPONENTS_SYNC_SYNCABLE_DIRECTORY_CHANGE_DELEGATE_H_ |
| OLD | NEW |