Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: sync/syncable/directory.h

Issue 1096543002: [Sync] Make Directory's protected methods private where possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // Getter/setters for the per datatype context. 295 // Getter/setters for the per datatype context.
296 void GetDataTypeContext(BaseTransaction* trans, 296 void GetDataTypeContext(BaseTransaction* trans,
297 ModelType type, 297 ModelType type,
298 sync_pb::DataTypeContext* context) const; 298 sync_pb::DataTypeContext* context) const;
299 void SetDataTypeContext(BaseWriteTransaction* trans, 299 void SetDataTypeContext(BaseWriteTransaction* trans,
300 ModelType type, 300 ModelType type,
301 const sync_pb::DataTypeContext& context); 301 const sync_pb::DataTypeContext& context);
302 302
303 ModelTypeSet InitialSyncEndedTypes(); 303 ModelTypeSet InitialSyncEndedTypes();
304 bool InitialSyncEndedForType(ModelType type); 304 bool InitialSyncEndedForType(ModelType type);
305 bool InitialSyncEndedForType(BaseTransaction* trans, ModelType type);
306
307 const std::string& name() const { return kernel_->name; }
308 305
309 // (Account) Store birthday is opaque to the client, so we keep it in the 306 // (Account) Store birthday is opaque to the client, so we keep it in the
310 // format it is in the proto buffer in case we switch to a binary birthday 307 // format it is in the proto buffer in case we switch to a binary birthday
311 // later. 308 // later.
312 std::string store_birthday() const; 309 std::string store_birthday() const;
313 void set_store_birthday(const std::string& store_birthday); 310 void set_store_birthday(const std::string& store_birthday);
314 311
315 // (Account) Bag of chip is an opaque state used by the server to track the 312 // (Account) Bag of chip is an opaque state used by the server to track the
316 // client. 313 // client.
317 std::string bag_of_chips() const; 314 std::string bag_of_chips() const;
318 void set_bag_of_chips(const std::string& bag_of_chips); 315 void set_bag_of_chips(const std::string& bag_of_chips);
319 316
320 // Unique to each account / client pair. 317 // Unique to each account / client pair.
321 std::string cache_guid() const; 318 std::string cache_guid() const;
322 319
323 // Returns a pointer to our Nigori node handler. 320 // Returns a pointer to our Nigori node handler.
324 NigoriHandler* GetNigoriHandler(); 321 NigoriHandler* GetNigoriHandler();
325 322
326 // Returns a pointer to our cryptographer. Does not transfer ownership. 323 // Returns a pointer to our cryptographer. Does not transfer ownership.
327 // Not thread safe, so should only be accessed while holding a transaction. 324 // Not thread safe, so should only be accessed while holding a transaction.
328 Cryptographer* GetCryptographer(const BaseTransaction* trans); 325 Cryptographer* GetCryptographer(const BaseTransaction* trans);
329 326
330 // Returns true if the directory had encountered an unrecoverable error.
331 // Note: Any function in |Directory| that can be called without holding a
332 // transaction need to check if the Directory already has an unrecoverable
333 // error on it.
334 bool unrecoverable_error_set(const BaseTransaction* trans) const;
335
336 // Called to immediately report an unrecoverable error (but don't 327 // Called to immediately report an unrecoverable error (but don't
337 // propagate it up). 328 // propagate it up).
338 void ReportUnrecoverableError() { 329 void ReportUnrecoverableError() {
339 if (report_unrecoverable_error_function_) { 330 if (report_unrecoverable_error_function_) {
340 report_unrecoverable_error_function_(); 331 report_unrecoverable_error_function_();
341 } 332 }
342 } 333 }
343 334
344 // Called to set the unrecoverable error on the directory and to propagate 335 // Called to set the unrecoverable error on the directory and to propagate
345 // the error to upper layers. 336 // the error to upper layers.
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 EntryKernel* entry, 612 EntryKernel* entry,
622 EntryKernelSet* entries_to_journal); 613 EntryKernelSet* entries_to_journal);
623 614
624 // A private version of the public GetMetaHandlesOfType for when you already 615 // A private version of the public GetMetaHandlesOfType for when you already
625 // have a ScopedKernelLock. 616 // have a ScopedKernelLock.
626 void GetMetaHandlesOfType(const ScopedKernelLock& lock, 617 void GetMetaHandlesOfType(const ScopedKernelLock& lock,
627 BaseTransaction* trans, 618 BaseTransaction* trans,
628 ModelType type, 619 ModelType type,
629 std::vector<int64>* result); 620 std::vector<int64>* result);
630 621
622 // Returns true if the initial sync for |type| has completed.
623 bool InitialSyncEndedForType(BaseTransaction* trans, ModelType type);
624
631 // Stops sending events to the delegate and the transaction 625 // Stops sending events to the delegate and the transaction
632 // observer. 626 // observer.
633 void Close(); 627 void Close();
634 628
629 // Returns true if the directory had encountered an unrecoverable error.
630 // 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 // error on it.
633 bool unrecoverable_error_set(const BaseTransaction* trans) const;
634
635 Kernel* kernel_; 635 Kernel* kernel_;
636 636
637 scoped_ptr<DirectoryBackingStore> store_; 637 scoped_ptr<DirectoryBackingStore> store_;
638 638
639 UnrecoverableErrorHandler* const unrecoverable_error_handler_; 639 UnrecoverableErrorHandler* const unrecoverable_error_handler_;
640 const ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; 640 const ReportUnrecoverableErrorFunction report_unrecoverable_error_function_;
641 bool unrecoverable_error_set_; 641 bool unrecoverable_error_set_;
642 642
643 // Not owned. 643 // Not owned.
644 NigoriHandler* const nigori_handler_; 644 NigoriHandler* const nigori_handler_;
645 Cryptographer* const cryptographer_; 645 Cryptographer* const cryptographer_;
646 646
647 InvariantCheckLevel invariant_check_level_; 647 InvariantCheckLevel invariant_check_level_;
648 648
649 // Maintain deleted entries not in |kernel_| until it's verified that they 649 // Maintain deleted entries not in |kernel_| until it's verified that they
650 // are deleted in native models as well. 650 // are deleted in native models as well.
651 scoped_ptr<DeleteJournal> delete_journal_; 651 scoped_ptr<DeleteJournal> delete_journal_;
652 652
653 DISALLOW_COPY_AND_ASSIGN(Directory); 653 DISALLOW_COPY_AND_ASSIGN(Directory);
654 }; 654 };
655 655
656 } // namespace syncable 656 } // namespace syncable
657 } // namespace syncer 657 } // namespace syncer
658 658
659 #endif // SYNC_SYNCABLE_DIRECTORY_H_ 659 #endif // SYNC_SYNCABLE_DIRECTORY_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698