| OLD | NEW |
| 1 // Copyright 2013 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_DIRECTORY_H_ | 5 #ifndef SYNC_SYNCABLE_DIRECTORY_H_ |
| 6 #define SYNC_SYNCABLE_DIRECTORY_H_ | 6 #define SYNC_SYNCABLE_DIRECTORY_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // The delegate for directory change events. Must not be NULL. | 241 // The delegate for directory change events. Must not be NULL. |
| 242 DirectoryChangeDelegate* const delegate; | 242 DirectoryChangeDelegate* const delegate; |
| 243 | 243 |
| 244 // The transaction observer. | 244 // The transaction observer. |
| 245 const WeakHandle<TransactionObserver> transaction_observer; | 245 const WeakHandle<TransactionObserver> transaction_observer; |
| 246 }; | 246 }; |
| 247 | 247 |
| 248 // Does not take ownership of |encryptor|. | 248 // Does not take ownership of |encryptor|. |
| 249 // |report_unrecoverable_error_function| may be NULL. | 249 // |report_unrecoverable_error_function| may be NULL. |
| 250 // Takes ownership of |store|. | 250 // Takes ownership of |store|. |
| 251 Directory(DirectoryBackingStore* store, | 251 Directory( |
| 252 UnrecoverableErrorHandler* unrecoverable_error_handler, | 252 DirectoryBackingStore* store, |
| 253 const base::Closure& report_unrecoverable_error_function, | 253 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, |
| 254 NigoriHandler* nigori_handler, | 254 const base::Closure& report_unrecoverable_error_function, |
| 255 Cryptographer* cryptographer); | 255 NigoriHandler* nigori_handler, |
| 256 Cryptographer* cryptographer); |
| 256 virtual ~Directory(); | 257 virtual ~Directory(); |
| 257 | 258 |
| 258 // Does not take ownership of |delegate|, which must not be NULL. | 259 // Does not take ownership of |delegate|, which must not be NULL. |
| 259 // Starts sending events to |delegate| if the returned result is | 260 // Starts sending events to |delegate| if the returned result is |
| 260 // OPENED. Note that events to |delegate| may be sent from *any* | 261 // OPENED. Note that events to |delegate| may be sent from *any* |
| 261 // thread. |transaction_observer| must be initialized. | 262 // thread. |transaction_observer| must be initialized. |
| 262 DirOpenResult Open(const std::string& name, | 263 DirOpenResult Open(const std::string& name, |
| 263 DirectoryChangeDelegate* delegate, | 264 DirectoryChangeDelegate* delegate, |
| 264 const WeakHandle<TransactionObserver>& | 265 const WeakHandle<TransactionObserver>& |
| 265 transaction_observer); | 266 transaction_observer); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 // Returns true if the directory had encountered an unrecoverable error. | 630 // Returns true if the directory had encountered an unrecoverable error. |
| 630 // Note: Any function in |Directory| that can be called without holding a | 631 // Note: Any function in |Directory| that can be called without holding a |
| 631 // transaction need to check if the Directory already has an unrecoverable | 632 // transaction need to check if the Directory already has an unrecoverable |
| 632 // error on it. | 633 // error on it. |
| 633 bool unrecoverable_error_set(const BaseTransaction* trans) const; | 634 bool unrecoverable_error_set(const BaseTransaction* trans) const; |
| 634 | 635 |
| 635 Kernel* kernel_; | 636 Kernel* kernel_; |
| 636 | 637 |
| 637 scoped_ptr<DirectoryBackingStore> store_; | 638 scoped_ptr<DirectoryBackingStore> store_; |
| 638 | 639 |
| 639 UnrecoverableErrorHandler* const unrecoverable_error_handler_; | 640 const WeakHandle<UnrecoverableErrorHandler> unrecoverable_error_handler_; |
| 640 base::Closure report_unrecoverable_error_function_; | 641 base::Closure report_unrecoverable_error_function_; |
| 641 bool unrecoverable_error_set_; | 642 bool unrecoverable_error_set_; |
| 642 | 643 |
| 643 // Not owned. | 644 // Not owned. |
| 644 NigoriHandler* const nigori_handler_; | 645 NigoriHandler* const nigori_handler_; |
| 645 Cryptographer* const cryptographer_; | 646 Cryptographer* const cryptographer_; |
| 646 | 647 |
| 647 InvariantCheckLevel invariant_check_level_; | 648 InvariantCheckLevel invariant_check_level_; |
| 648 | 649 |
| 649 // Maintain deleted entries not in |kernel_| until it's verified that they | 650 // Maintain deleted entries not in |kernel_| until it's verified that they |
| 650 // are deleted in native models as well. | 651 // are deleted in native models as well. |
| 651 scoped_ptr<DeleteJournal> delete_journal_; | 652 scoped_ptr<DeleteJournal> delete_journal_; |
| 652 | 653 |
| 653 base::WeakPtrFactory<Directory> weak_ptr_factory_; | 654 base::WeakPtrFactory<Directory> weak_ptr_factory_; |
| 654 | 655 |
| 655 DISALLOW_COPY_AND_ASSIGN(Directory); | 656 DISALLOW_COPY_AND_ASSIGN(Directory); |
| 656 }; | 657 }; |
| 657 | 658 |
| 658 } // namespace syncable | 659 } // namespace syncable |
| 659 } // namespace syncer | 660 } // namespace syncer |
| 660 | 661 |
| 661 #endif // SYNC_SYNCABLE_DIRECTORY_H_ | 662 #endif // SYNC_SYNCABLE_DIRECTORY_H_ |
| OLD | NEW |