Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / sync / notifier / invalidation_util.h
blobeac4bac5b66931f73e2ee930e984bfce14f7c000
1 // Copyright 2012 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.
7 #ifndef SYNC_NOTIFIER_INVALIDATION_UTIL_H_
8 #define SYNC_NOTIFIER_INVALIDATION_UTIL_H_
10 #include <iosfwd>
11 #include <map>
12 #include <set>
13 #include <string>
15 #include "base/memory/scoped_ptr.h"
16 #include "sync/base/sync_export.h"
17 #include "sync/internal_api/public/base/model_type.h"
19 namespace base {
20 class DictionaryValue;
21 } // namespace
23 namespace invalidation {
25 class Invalidation;
26 class ObjectId;
28 // Gmock print helper
29 SYNC_EXPORT_PRIVATE void PrintTo(const invalidation::ObjectId& id,
30 std::ostream* os);
32 } // namespace invalidation
34 namespace syncer {
36 class Invalidation;
38 struct SYNC_EXPORT ObjectIdLessThan {
39 bool operator()(const invalidation::ObjectId& lhs,
40 const invalidation::ObjectId& rhs) const;
43 struct SYNC_EXPORT InvalidationVersionLessThan {
44 bool operator()(const syncer::Invalidation& a,
45 const syncer::Invalidation& b) const;
48 typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet;
50 typedef std::map<invalidation::ObjectId, int, ObjectIdLessThan>
51 ObjectIdCountMap;
53 SYNC_EXPORT bool RealModelTypeToObjectId(ModelType model_type,
54 invalidation::ObjectId* object_id);
56 bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id,
57 ModelType* model_type);
59 // Caller owns the returned DictionaryValue.
60 scoped_ptr<base::DictionaryValue> ObjectIdToValue(
61 const invalidation::ObjectId& object_id);
63 bool ObjectIdFromValue(const base::DictionaryValue& value,
64 invalidation::ObjectId* out);
66 SYNC_EXPORT_PRIVATE std::string ObjectIdToString(
67 const invalidation::ObjectId& object_id);
69 SYNC_EXPORT_PRIVATE ObjectIdSet ModelTypeSetToObjectIdSet(ModelTypeSet models);
70 ModelTypeSet ObjectIdSetToModelTypeSet(const ObjectIdSet& ids);
72 std::string InvalidationToString(
73 const invalidation::Invalidation& invalidation);
75 } // namespace syncer
77 #endif // SYNC_NOTIFIER_INVALIDATION_UTIL_H_