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

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: . Created 7 years, 10 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 590
589 // InvalidationFrontend implementation. It is an error to have 591 // InvalidationFrontend implementation. It is an error to have
590 // registered handlers when Shutdown() is called. 592 // registered handlers when Shutdown() is called.
591 virtual void RegisterInvalidationHandler( 593 virtual void RegisterInvalidationHandler(
592 syncer::InvalidationHandler* handler) OVERRIDE; 594 syncer::InvalidationHandler* handler) OVERRIDE;
593 virtual void UpdateRegisteredInvalidationIds( 595 virtual void UpdateRegisteredInvalidationIds(
594 syncer::InvalidationHandler* handler, 596 syncer::InvalidationHandler* handler,
595 const syncer::ObjectIdSet& ids) OVERRIDE; 597 const syncer::ObjectIdSet& ids) OVERRIDE;
596 virtual void UnregisterInvalidationHandler( 598 virtual void UnregisterInvalidationHandler(
597 syncer::InvalidationHandler* handler) OVERRIDE; 599 syncer::InvalidationHandler* handler) OVERRIDE;
600 virtual void AcknowledgeInvalidation(
601 const invalidation::ObjectId& id,
602 const syncer::AckHandle& ack_handle) OVERRIDE;
603
598 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; 604 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE;
599 605
600 // ProfileKeyedService implementation. This must be called exactly 606 // ProfileKeyedService implementation. This must be called exactly
601 // once (before this object is destroyed). 607 // once (before this object is destroyed).
602 virtual void Shutdown() OVERRIDE; 608 virtual void Shutdown() OVERRIDE;
603 609
604 // Simulate an incoming notification for the given id and payload. 610 // Simulate an incoming notification for the given id and payload.
605 void EmitInvalidationForTest( 611 void EmitInvalidationForTest(
606 const invalidation::ObjectId& id, 612 const invalidation::ObjectId& id,
607 const std::string& payload); 613 const std::string& payload);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 private: 668 private:
663 enum UnrecoverableErrorReason { 669 enum UnrecoverableErrorReason {
664 ERROR_REASON_UNSET, 670 ERROR_REASON_UNSET,
665 ERROR_REASON_SYNCER, 671 ERROR_REASON_SYNCER,
666 ERROR_REASON_BACKEND_INIT_FAILURE, 672 ERROR_REASON_BACKEND_INIT_FAILURE,
667 ERROR_REASON_CONFIGURATION_RETRY, 673 ERROR_REASON_CONFIGURATION_RETRY,
668 ERROR_REASON_CONFIGURATION_FAILURE, 674 ERROR_REASON_CONFIGURATION_FAILURE,
669 ERROR_REASON_ACTIONABLE_ERROR, 675 ERROR_REASON_ACTIONABLE_ERROR,
670 ERROR_REASON_LIMIT 676 ERROR_REASON_LIMIT
671 }; 677 };
678 typedef std::vector<std::pair<invalidation::ObjectId,
679 syncer::AckHandle> > AckHandleReplayQueue;
672 friend class ProfileSyncServicePasswordTest; 680 friend class ProfileSyncServicePasswordTest;
673 friend class SyncTest; 681 friend class SyncTest;
674 friend class TestProfileSyncService; 682 friend class TestProfileSyncService;
675 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState); 683 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState);
676 684
677 // Detects and attempts to recover from a previous improper datatype 685 // Detects and attempts to recover from a previous improper datatype
678 // configuration where Keep Everything Synced and the preferred types were 686 // configuration where Keep Everything Synced and the preferred types were
679 // not correctly set. 687 // not correctly set.
680 void TrySyncDatatypePrefRecovery(); 688 void TrySyncDatatypePrefRecovery();
681 689
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 897
890 // Holds the current invalidator state as updated by 898 // Holds the current invalidator state as updated by
891 // OnInvalidatorStateChange(). Note that this is different from the 899 // OnInvalidatorStateChange(). Note that this is different from the
892 // state known by |invalidator_registrar_| (See 900 // state known by |invalidator_registrar_| (See
893 // UpdateInvalidatorState()). 901 // UpdateInvalidatorState()).
894 syncer::InvalidatorState invalidator_state_; 902 syncer::InvalidatorState invalidator_state_;
895 903
896 // Dispatches invalidations to handlers. Set in Initialize() and 904 // Dispatches invalidations to handlers. Set in Initialize() and
897 // unset in Shutdown(). 905 // unset in Shutdown().
898 scoped_ptr<syncer::InvalidatorRegistrar> invalidator_registrar_; 906 scoped_ptr<syncer::InvalidatorRegistrar> invalidator_registrar_;
907 // Queues any acknowledgements received while the backend is uninitialized.
908 AckHandleReplayQueue ack_replay_queue_;
899 909
900 // Sync's internal debug info listener. Used to record datatype configuration 910 // Sync's internal debug info listener. Used to record datatype configuration
901 // and association information. 911 // and association information.
902 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; 912 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_;
903 913
904 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 914 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
905 }; 915 };
906 916
907 bool ShouldShowActionOnUI( 917 bool ShouldShowActionOnUI(
908 const syncer::SyncProtocolError& error); 918 const syncer::SyncProtocolError& error);
909 919
910 920
911 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 921 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698