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

Unified Diff: trunk/src/chrome/browser/sync/profile_sync_service.h

Issue 17610004: Revert 208315 "Make use of InvalidationService" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/sync/profile_sync_service.h
===================================================================
--- trunk/src/chrome/browser/sync/profile_sync_service.h (revision 208346)
+++ trunk/src/chrome/browser/sync/profile_sync_service.h (working copy)
@@ -19,6 +19,8 @@
#include "base/strings/string16.h"
#include "base/time.h"
#include "base/timer.h"
+#include "chrome/browser/invalidation/invalidation_frontend.h"
+#include "chrome/browser/invalidation/invalidator_storage.h"
#include "chrome/browser/signin/oauth2_token_service.h"
#include "chrome/browser/signin/signin_global_error.h"
#include "chrome/browser/sync/backend_unrecoverable_error_handler.h"
@@ -63,6 +65,7 @@
namespace syncer {
class BaseTransaction;
+class InvalidatorRegistrar;
struct SyncCredentials;
struct UserShare;
}
@@ -162,6 +165,7 @@
public syncer::UnrecoverableErrorHandler,
public content::NotificationObserver,
public BrowserContextKeyedService,
+ public invalidation::InvalidationFrontend,
public browser_sync::DataTypeEncryptionHandler,
public OAuth2TokenService::Consumer {
public:
@@ -284,6 +288,12 @@
// Disables sync for user. Use ShowLoginDialog to enable.
virtual void DisableForUser();
+ // syncer::InvalidationHandler implementation (via SyncFrontend).
+ virtual void OnInvalidatorStateChange(
+ syncer::InvalidatorState state) OVERRIDE;
+ virtual void OnIncomingInvalidation(
+ const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE;
+
// SyncFrontend implementation.
virtual void OnBackendInitialized(
const syncer::WeakHandle<syncer::JsBackend>& js_backend,
@@ -590,6 +600,21 @@
// The set of currently enabled sync experiments.
const syncer::Experiments& current_experiments() const;
+ // InvalidationFrontend implementation. It is an error to have
+ // registered handlers when Shutdown() is called.
+ virtual void RegisterInvalidationHandler(
+ syncer::InvalidationHandler* handler) OVERRIDE;
+ virtual void UpdateRegisteredInvalidationIds(
+ syncer::InvalidationHandler* handler,
+ const syncer::ObjectIdSet& ids) OVERRIDE;
+ virtual void UnregisterInvalidationHandler(
+ syncer::InvalidationHandler* handler) OVERRIDE;
+ virtual void AcknowledgeInvalidation(
+ const invalidation::ObjectId& id,
+ const syncer::AckHandle& ack_handle) OVERRIDE;
+
+ virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE;
+
// OAuth2TokenService::Consumer implementation
virtual void OnGetTokenSuccess(
const OAuth2TokenService::Request* request,
@@ -603,6 +628,11 @@
// once (before this object is destroyed).
virtual void Shutdown() OVERRIDE;
+ // Simulate an incoming notification for the given id and payload.
+ void EmitInvalidationForTest(
+ const invalidation::ObjectId& id,
+ const std::string& payload);
+
// Called when a datatype (SyncableService) has a need for sync to start
// ASAP, presumably because a local change event has occurred but we're
// still in deferred start mode, meaning the SyncableService hasn't been
@@ -673,6 +703,8 @@
ERROR_REASON_ACTIONABLE_ERROR,
ERROR_REASON_LIMIT
};
+ typedef std::vector<std::pair<invalidation::ObjectId,
+ syncer::AckHandle> > AckHandleReplayQueue;
friend class ProfileSyncServicePasswordTest;
friend class SyncTest;
friend class TestProfileSyncService;
@@ -719,7 +751,6 @@
void UpdateLastSyncedTime();
void NotifyObservers();
- void NotifySyncCycleCompleted();
void ClearStaleErrors();
@@ -769,6 +800,11 @@
bool delete_sync_database,
UnrecoverableErrorReason reason);
+ // Must be called every time |backend_initialized_| or
+ // |invalidator_state_| is changed (but only if
+ // |invalidator_registrar_| is not NULL).
+ void UpdateInvalidatorRegistrarState();
+
// Returns the username (in form of an email address) that should be used in
// the credentials.
std::string GetEffectiveUsername();
@@ -783,6 +819,9 @@
// preferences.
browser_sync::SyncPrefs sync_prefs_;
+ // TODO(tim): Move this to InvalidationService, once it exists. Bug 124137.
+ invalidation::InvalidatorStorage invalidator_storage_;
+
// TODO(ncarter): Put this in a profile, once there is UI for it.
// This specifies where to find the sync server.
GURL sync_service_url_;
@@ -903,6 +942,18 @@
// Factory the backend will use to build the SyncManager.
syncer::SyncManagerFactory sync_manager_factory_;
+ // Holds the current invalidator state as updated by
+ // OnInvalidatorStateChange(). Note that this is different from the
+ // state known by |invalidator_registrar_| (See
+ // UpdateInvalidatorState()).
+ syncer::InvalidatorState invalidator_state_;
+
+ // Dispatches invalidations to handlers. Set in Initialize() and
+ // unset in Shutdown().
+ scoped_ptr<syncer::InvalidatorRegistrar> invalidator_registrar_;
+ // Queues any acknowledgements received while the backend is uninitialized.
+ AckHandleReplayQueue ack_replay_queue_;
+
// Sync's internal debug info listener. Used to record datatype configuration
// and association information.
syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_;

Powered by Google App Engine
This is Rietveld 408576698