summaryrefslogtreecommitdiffstats
path: root/sync/notifier/invalidator_registrar.h
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-02 22:17:50 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-02 22:17:50 +0000
commit24c9ee594694a646eec1e5028cdd088cf4d73f9d (patch)
treece7cbdceee342e9af83a5002814d3481f800561a /sync/notifier/invalidator_registrar.h
parent4d488032475256413d3aa347407b77f21ca11633 (diff)
downloadchromium_src-24c9ee594694a646eec1e5028cdd088cf4d73f9d.zip
chromium_src-24c9ee594694a646eec1e5028cdd088cf4d73f9d.tar.gz
chromium_src-24c9ee594694a646eec1e5028cdd088cf4d73f9d.tar.bz2
Move some sync/notifier to components/invalidation
Moves many of the files in sync/notifier to components/invalidation. This change does not introduce any new dependencies. The relevant dependency rules both before and after this change should be: - chrome/browser/invalidation and chrome in general depend on components/invalidation. - components/invalidation depends on sync/notifier and sync in general. - sync/notifier, components/invalidation, and various parts of chrome all depend on sync/internal_api/public. The eventual goal is to move all of sync/notifier into components/invalidation. The invalidation-related parts of sync/internal_api/public should be moved to components/invalidation, too. This will allow us to remove the deopendencies from components/invalidation to sync, and remove sync's dependencies on cacheinvalidation and libjingle. This change is a regression in terms of shared library componentization. the files in the sync/notifier folder could be built as a shared library. The files in compononents/invalidation do not support this yet. The SYNC_EXPORT declarations in the moved files have been changed to INVALIDATION_EXPORT so as to not lose this information, but the macros are currently #defined to no-ops. This change does not attempt to rename any classes or namespaces. Many of the files ported from sync/notifier still use the syncer namespace. Some, like SyncSystemResources, still have names tied to their sync heritage. This will be addressed in future CLs. Some non-trivial or non-obvious changes include: - invalidator_state.h was moved to sync/internal_api/public/base so it could be shared by both sync/ and components/invalidation. This should be fixed in a future CL. - FromNotifierReason was split out of invalidator_state.h and moved to the newly-created components/invalidator_reason_util.h TBR=zea,rtenneti,mallinath,dcheng BUG=259559 Review URL: https://codereview.chromium.org/294123004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/notifier/invalidator_registrar.h')
-rw-r--r--sync/notifier/invalidator_registrar.h97
1 files changed, 0 insertions, 97 deletions
diff --git a/sync/notifier/invalidator_registrar.h b/sync/notifier/invalidator_registrar.h
deleted file mode 100644
index 145b7c3..0000000
--- a/sync/notifier/invalidator_registrar.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_
-#define SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_
-
-#include <map>
-
-#include "base/basictypes.h"
-#include "base/observer_list.h"
-#include "base/threading/thread_checker.h"
-#include "sync/base/sync_export.h"
-#include "sync/notifier/invalidation_handler.h"
-#include "sync/notifier/invalidation_util.h"
-
-namespace invalidation {
-class ObjectId;
-} // namespace invalidation
-
-namespace syncer {
-
-class ObjectIdInvalidationMap;
-
-// A helper class for implementations of the Invalidator interface. It helps
-// keep track of registered handlers and which object ID registrations are
-// associated with which handlers, so implementors can just reuse the logic
-// here to dispatch invalidations and other interesting notifications.
-class SYNC_EXPORT InvalidatorRegistrar {
- public:
- InvalidatorRegistrar();
-
- // It is an error to have registered handlers on destruction.
- ~InvalidatorRegistrar();
-
- // Starts sending notifications to |handler|. |handler| must not be NULL,
- // and it must already be registered.
- void RegisterHandler(InvalidationHandler* handler);
-
- // Updates the set of ObjectIds associated with |handler|. |handler| must
- // not be NULL, and must already be registered. An ID must be registered for
- // at most one handler.
- void UpdateRegisteredIds(InvalidationHandler* handler,
- const ObjectIdSet& ids);
-
- // Stops sending notifications to |handler|. |handler| must not be NULL, and
- // it must already be registered. Note that this doesn't unregister the IDs
- // associated with |handler|.
- void UnregisterHandler(InvalidationHandler* handler);
-
- ObjectIdSet GetRegisteredIds(InvalidationHandler* handler) const;
-
- // Returns the set of all IDs that are registered to some handler (even
- // handlers that have been unregistered).
- ObjectIdSet GetAllRegisteredIds() const;
-
- // Sorts incoming invalidations into a bucket for each handler and then
- // dispatches the batched invalidations to the corresponding handler.
- // Invalidations for IDs with no corresponding handler are dropped, as are
- // invalidations for handlers that are not added.
- void DispatchInvalidationsToHandlers(
- const ObjectIdInvalidationMap& invalidation_map);
-
- // Updates the invalidator state to the given one and then notifies
- // all handlers. Note that the order is important; handlers that
- // call GetInvalidatorState() when notified will see the new state.
- void UpdateInvalidatorState(InvalidatorState state);
-
- // Returns the current invalidator state. When called from within
- // InvalidationHandler::OnInvalidatorStateChange(), this returns the
- // updated state.
- InvalidatorState GetInvalidatorState() const;
-
- // Gets a new map for the name of invalidator handlers and their
- // objects id. This is used by the InvalidatorLogger to be able
- // to display every registered handlers and its objectsIds.
- std::map<std::string, ObjectIdSet> GetSanitizedHandlersIdsMap();
-
- bool IsHandlerRegisteredForTest(InvalidationHandler* handler) const;
-
- // Needed for death tests.
- void DetachFromThreadForTest();
-
- private:
- typedef std::map<InvalidationHandler*, ObjectIdSet> HandlerIdsMap;
-
- base::ThreadChecker thread_checker_;
- ObserverList<InvalidationHandler> handlers_;
- HandlerIdsMap handler_to_ids_map_;
- InvalidatorState state_;
-
- DISALLOW_COPY_AND_ASSIGN(InvalidatorRegistrar);
-};
-
-} // namespace syncer
-
-#endif // SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_