Move sync/notifier to components/invalidation
Moves all code remaining in sync/notifier to components/invalidation.
Updates gyp files, DEPS, and #includes accordingly.
In terms of program behavior, this should be one big no-op. This CL
contains no non-trivial code changes.
In terms of the build system, this is a significant change. Symbols
that were previously exported through sync_notifier and related targets
have moved into the components/invalidation related targets. Some
SYNC_EXPORT macros have been replaced with INVALIDATION_EXPORT, which is
significant since INVALIDATION_EXPORT is currently a no-op but
SYNC_EXPORT has meaning under some build configurations.
Unlike most other files in sync/notifier, invalidation_util.{cc,h} was
moved to sync/internal_api/public/base. This is so it could be
referenced from sync/internal_api/public/base/invalidation.cc. This is
a slight regression, but it should be fixed in the next CL when we move
all invalidations-related code out of sync/internal_api.
TBR=rogerta,benwells
BUG=259559
Review URL: https://codereview.chromium.org/387733004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283840 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/components/invalidation/single_object_invalidation_set.h b/components/invalidation/single_object_invalidation_set.h
new file mode 100644
index 0000000..11ab3e3a
--- /dev/null
+++ b/components/invalidation/single_object_invalidation_set.h
@@ -0,0 +1,64 @@
+// Copyright 2014 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 COMPONENTS_INVALIDATION_SINGLE_OBJECT_INVALIDATION_SET_H_
+#define COMPONENTS_INVALIDATION_SINGLE_OBJECT_INVALIDATION_SET_H_
+
+#include <set>
+
+#include "base/memory/scoped_ptr.h"
+#include "components/invalidation/invalidation_export.h"
+#include "sync/internal_api/public/base/invalidation.h"
+#include "sync/internal_api/public/base/invalidation_util.h"
+
+namespace base {
+class ListValue;
+} // namespace base
+
+namespace syncer {
+
+// Holds a list of invalidations that all share the same Object ID.
+//
+// The list is kept sorted by version to make it easier to perform common
+// operations, like checking for an unknown version invalidation or fetching the
+// highest invalidation with the highest version number.
+class INVALIDATION_EXPORT SingleObjectInvalidationSet {
+ public:
+ typedef std::set<Invalidation, InvalidationVersionLessThan> InvalidationsSet;
+ typedef InvalidationsSet::const_iterator const_iterator;
+ typedef InvalidationsSet::const_reverse_iterator const_reverse_iterator;
+
+ SingleObjectInvalidationSet();
+ ~SingleObjectInvalidationSet();
+
+ void Insert(const Invalidation& invalidation);
+ void InsertAll(const SingleObjectInvalidationSet& other);
+ void Clear();
+ void Erase(const_iterator it);
+
+ // Returns true if this list contains an unknown version.
+ //
+ // Unknown version invalidations always end up at the start of the list,
+ // because they have the lowest possible value in the sort ordering.
+ bool StartsWithUnknownVersion() const;
+ size_t GetSize() const;
+ bool IsEmpty() const;
+ bool operator==(const SingleObjectInvalidationSet& other) const;
+
+ const_iterator begin() const;
+ const_iterator end() const;
+ const_reverse_iterator rbegin() const;
+ const_reverse_iterator rend() const;
+ const Invalidation& back() const;
+
+ scoped_ptr<base::ListValue> ToValue() const;
+ bool ResetFromValue(const base::ListValue& list);
+
+ private:
+ InvalidationsSet invalidations_;
+};
+
+} // syncer
+
+#endif // COMPONENTS_INVALIDATION_SINGLE_OBJECT_INVALIDATION_SET_H_