invalidation_util.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. //
  5. // Various utilities for dealing with invalidation data types.
  6. #ifndef COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_UTIL_H_
  7. #define COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_UTIL_H_
  8. #include <map>
  9. #include <memory>
  10. #include <set>
  11. #include <string>
  12. #include "base/callback.h"
  13. #include "components/invalidation/public/invalidation_export.h"
  14. namespace invalidation {
  15. class Invalidation;
  16. struct INVALIDATION_EXPORT InvalidationVersionLessThan {
  17. bool operator()(const Invalidation& a, const Invalidation& b) const;
  18. };
  19. using Topic = std::string;
  20. // It should be std::set, since std::set_difference is used for it.
  21. using TopicSet = std::set<std::string>;
  22. using TopicCountMap = std::map<Topic, int>;
  23. INVALIDATION_EXPORT struct TopicMetadata {
  24. // Whether the topic is public.
  25. bool is_public;
  26. };
  27. INVALIDATION_EXPORT bool operator==(const TopicMetadata&, const TopicMetadata&);
  28. using Topics = std::map<std::string, TopicMetadata>;
  29. } // namespace invalidation
  30. #endif // COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_UTIL_H_