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

Side by Side Diff: chrome/browser/sync/profile_sync_service.h

Issue 10911084: Implement Invalidator::Acknowledge (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adapt patch to new TickClock interface Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <utility>
11 #include <vector>
10 12
11 #include "base/basictypes.h" 13 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
14 #include "base/location.h" 16 #include "base/location.h"
15 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
17 #include "base/observer_list.h" 19 #include "base/observer_list.h"
18 #include "base/string16.h" 20 #include "base/string16.h"
19 #include "base/time.h" 21 #include "base/time.h"
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 594
593 // InvalidationFrontend implementation. It is an error to have 595 // InvalidationFrontend implementation. It is an error to have
594 // registered handlers when Shutdown() is called. 596 // registered handlers when Shutdown() is called.
595 virtual void RegisterInvalidationHandler( 597 virtual void RegisterInvalidationHandler(
596 syncer::InvalidationHandler* handler) OVERRIDE; 598 syncer::InvalidationHandler* handler) OVERRIDE;
597 virtual void UpdateRegisteredInvalidationIds( 599 virtual void UpdateRegisteredInvalidationIds(
598 syncer::InvalidationHandler* handler, 600 syncer::InvalidationHandler* handler,
599 const syncer::ObjectIdSet& ids) OVERRIDE; 601 const syncer::ObjectIdSet& ids) OVERRIDE;
600 virtual void UnregisterInvalidationHandler( 602 virtual void UnregisterInvalidationHandler(
601 syncer::InvalidationHandler* handler) OVERRIDE; 603 syncer::InvalidationHandler* handler) OVERRIDE;
604 virtual void AcknowledgeInvalidation(
605 const invalidation::ObjectId& id,
606 const syncer::AckHandle& ack_handle) OVERRIDE;
607
602 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; 608 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE;
603 609
604 // ProfileKeyedService implementation. This must be called exactly 610 // ProfileKeyedService implementation. This must be called exactly
605 // once (before this object is destroyed). 611 // once (before this object is destroyed).
606 virtual void Shutdown() OVERRIDE; 612 virtual void Shutdown() OVERRIDE;
607 613
608 // Simulate an incoming notification for the given id and payload. 614 // Simulate an incoming notification for the given id and payload.
609 void EmitInvalidationForTest( 615 void EmitInvalidationForTest(
610 const invalidation::ObjectId& id, 616 const invalidation::ObjectId& id,
611 const std::string& payload); 617 const std::string& payload);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 private: 672 private:
667 enum UnrecoverableErrorReason { 673 enum UnrecoverableErrorReason {
668 ERROR_REASON_UNSET, 674 ERROR_REASON_UNSET,
669 ERROR_REASON_SYNCER, 675 ERROR_REASON_SYNCER,
670 ERROR_REASON_BACKEND_INIT_FAILURE, 676 ERROR_REASON_BACKEND_INIT_FAILURE,
671 ERROR_REASON_CONFIGURATION_RETRY, 677 ERROR_REASON_CONFIGURATION_RETRY,
672 ERROR_REASON_CONFIGURATION_FAILURE, 678 ERROR_REASON_CONFIGURATION_FAILURE,
673 ERROR_REASON_ACTIONABLE_ERROR, 679 ERROR_REASON_ACTIONABLE_ERROR,
674 ERROR_REASON_LIMIT 680 ERROR_REASON_LIMIT
675 }; 681 };
682 typedef std::vector<std::pair<invalidation::ObjectId,
683 syncer::AckHandle> > AckHandleReplayQueue;
676 friend class ProfileSyncServicePasswordTest; 684 friend class ProfileSyncServicePasswordTest;
677 friend class SyncTest; 685 friend class SyncTest;
678 friend class TestProfileSyncService; 686 friend class TestProfileSyncService;
679 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState); 687 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState);
680 688
681 // Detects and attempts to recover from a previous improper datatype 689 // Detects and attempts to recover from a previous improper datatype
682 // configuration where Keep Everything Synced and the preferred types were 690 // configuration where Keep Everything Synced and the preferred types were
683 // not correctly set. 691 // not correctly set.
684 void TrySyncDatatypePrefRecovery(); 692 void TrySyncDatatypePrefRecovery();
685 693
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 901
894 // Holds the current invalidator state as updated by 902 // Holds the current invalidator state as updated by
895 // OnInvalidatorStateChange(). Note that this is different from the 903 // OnInvalidatorStateChange(). Note that this is different from the
896 // state known by |invalidator_registrar_| (See 904 // state known by |invalidator_registrar_| (See
897 // UpdateInvalidatorState()). 905 // UpdateInvalidatorState()).
898 syncer::InvalidatorState invalidator_state_; 906 syncer::InvalidatorState invalidator_state_;
899 907
900 // Dispatches invalidations to handlers. Set in Initialize() and 908 // Dispatches invalidations to handlers. Set in Initialize() and
901 // unset in Shutdown(). 909 // unset in Shutdown().
902 scoped_ptr<syncer::InvalidatorRegistrar> invalidator_registrar_; 910 scoped_ptr<syncer::InvalidatorRegistrar> invalidator_registrar_;
911 // Queues any acknowledgements received while the backend is uninitialized.
912 AckHandleReplayQueue ack_replay_queue_;
903 913
904 // Sync's internal debug info listener. Used to record datatype configuration 914 // Sync's internal debug info listener. Used to record datatype configuration
905 // and association information. 915 // and association information.
906 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; 916 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_;
907 917
908 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 918 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
909 }; 919 };
910 920
911 bool ShouldShowActionOnUI( 921 bool ShouldShowActionOnUI(
912 const syncer::SyncProtocolError& error); 922 const syncer::SyncProtocolError& error);
913 923
914 924
915 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 925 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/invalidation_frontend.h ('k') | chrome/browser/sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698