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

Unified Diff: sync/notifier/object_id_invalidation_map.h

Issue 23441042: Refactor common invalidation framework types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 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: sync/notifier/object_id_invalidation_map.h
diff --git a/sync/notifier/object_id_invalidation_map.h b/sync/notifier/object_id_invalidation_map.h
index bb97fb3b1337f63a9ee7b7200c6095d6da53a823..3af93f675a17ff4daa981bbb074e3f8cd9981349 100644
--- a/sync/notifier/object_id_invalidation_map.h
+++ b/sync/notifier/object_id_invalidation_map.h
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 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.
@@ -6,40 +6,46 @@
#define SYNC_NOTIFIER_OBJECT_ID_INVALIDATION_MAP_H_
#include <map>
-#include <string>
+#include <vector>
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "google/cacheinvalidation/include/types.h"
#include "sync/base/sync_export.h"
#include "sync/internal_api/public/base/invalidation.h"
#include "sync/notifier/invalidation_util.h"
-
-namespace base {
-class ListValue;
-} // namespace base
+#include "sync/notifier/ordered_invalidation_list.h"
namespace syncer {
-typedef std::map<invalidation::ObjectId,
- Invalidation,
- ObjectIdLessThan> ObjectIdInvalidationMap;
+class SYNC_EXPORT ObjectIdInvalidationMap {
tim (not reviewing) 2013/09/20 21:53:46 What is this class supposed to do? Looking at it
rlarocque 2013/09/23 18:38:19 This class is supposed to be a container for many
tim (not reviewing) 2013/09/24 21:16:54 I see. So it's returning a subset / projection of
rlarocque 2013/09/25 00:40:00 GetSubsetWithObjectIds() makes sense to me.
+ public:
+ static ObjectIdInvalidationMap InvalidateAll(const ObjectIdSet& ids);
+
+ ObjectIdInvalidationMap();
+ ~ObjectIdInvalidationMap();
+
+ ObjectIdSet GetObjectIds() const;
+ bool Empty() const;
+ bool operator==(const ObjectIdInvalidationMap& other) const;
+
+ void Insert(const Invalidation& invalidation);
+
+ ObjectIdInvalidationMap WithObjects(const ObjectIdSet& ids) const;
tim (not reviewing) 2013/09/20 21:53:46 Are there any basic tests for this filtering?
rlarocque 2013/09/23 18:38:19 No, there are no tests for any part of this class.
tim (not reviewing) 2013/09/24 21:16:54 Great!
+ const OrderedInvalidationList& ForObject(invalidation::ObjectId id) const;
+ void GetAllInvalidations(std::vector<syncer::Invalidation>* out) const;
+
+ scoped_ptr<base::ListValue> ToValue() const;
+ bool ResetFromValue(const base::ListValue& value);
-// Converts between ObjectIdInvalidationMaps and ObjectIdSets.
-ObjectIdSet ObjectIdInvalidationMapToSet(
- const ObjectIdInvalidationMap& invalidation_map);
-SYNC_EXPORT ObjectIdInvalidationMap ObjectIdSetToInvalidationMap(
- const ObjectIdSet& ids, int64 version, const std::string& payload);
+ std::string ToString() const;
-SYNC_EXPORT bool ObjectIdInvalidationMapEquals(
- const ObjectIdInvalidationMap& invalidation_map1,
- const ObjectIdInvalidationMap& invalidation_map2);
+ private:
+ typedef std::map<invalidation::ObjectId,
+ OrderedInvalidationList,
+ ObjectIdLessThan> IdToListMap;
-scoped_ptr<base::ListValue> ObjectIdInvalidationMapToValue(
- const ObjectIdInvalidationMap& invalidation_map);
+ ObjectIdInvalidationMap(const IdToListMap& map);
-bool ObjectIdInvalidationMapFromValue(const base::ListValue& value,
- ObjectIdInvalidationMap* out);
+ IdToListMap map_;
+};
} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698