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

Side by Side Diff: sync/engine/syncer_proto_util.h

Issue 10916174: Implement a bag of chips for sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Follow review Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/engine/download_updates_command.cc ('k') | sync/engine/syncer_proto_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ 5 #ifndef SYNC_ENGINE_SYNCER_PROTO_UTIL_H_
6 #define SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ 6 #define SYNC_ENGINE_SYNCER_PROTO_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 std::string* proto_bytes); 67 std::string* proto_bytes);
68 68
69 // Extract the name field from a sync entity. 69 // Extract the name field from a sync entity.
70 static const std::string& NameFromSyncEntity( 70 static const std::string& NameFromSyncEntity(
71 const sync_pb::SyncEntity& entry); 71 const sync_pb::SyncEntity& entry);
72 72
73 // Extract the name field from a commit entry response. 73 // Extract the name field from a commit entry response.
74 static const std::string& NameFromCommitEntryResponse( 74 static const std::string& NameFromCommitEntryResponse(
75 const sync_pb::CommitResponse_EntryResponse& entry); 75 const sync_pb::CommitResponse_EntryResponse& entry);
76 76
77 // Persist the bag of chips if it is present in the response.
78 static void PersistBagOfChips(
79 syncable::Directory* dir,
80 const sync_pb::ClientToServerResponse& response);
81
77 // EntitySpecifics is used as a filter for the GetUpdates message to tell 82 // EntitySpecifics is used as a filter for the GetUpdates message to tell
78 // the server which datatypes to send back. This adds a datatype so that 83 // the server which datatypes to send back. This adds a datatype so that
79 // it's included in the filter. 84 // it's included in the filter.
80 static void AddToEntitySpecificDatatypesFilter(ModelType datatype, 85 static void AddToEntitySpecificDatatypesFilter(ModelType datatype,
81 sync_pb::EntitySpecifics* filter); 86 sync_pb::EntitySpecifics* filter);
82 87
83 // Get a debug string representation of the client to server response. 88 // Get a debug string representation of the client to server response.
84 static std::string ClientToServerResponseDebugString( 89 static std::string ClientToServerResponseDebugString(
85 const sync_pb::ClientToServerResponse& response); 90 const sync_pb::ClientToServerResponse& response);
86 91
87 // Get update contents as a string. Intended for logging, and intended 92 // Get update contents as a string. Intended for logging, and intended
88 // to have a smaller footprint than the protobuf's built-in pretty printer. 93 // to have a smaller footprint than the protobuf's built-in pretty printer.
89 static std::string SyncEntityDebugString(const sync_pb::SyncEntity& entry); 94 static std::string SyncEntityDebugString(const sync_pb::SyncEntity& entry);
90 95
91 // Pull the birthday from the dir and put it into the msg. 96 // Pull the birthday from the dir and put it into the msg.
92 static void AddRequestBirthday(syncable::Directory* dir, 97 static void AddRequestBirthday(syncable::Directory* dir,
93 sync_pb::ClientToServerMessage* msg); 98 sync_pb::ClientToServerMessage* msg);
94 99
100 // Pull the bag of chips from the dir and put it into the msg.
101 static void AddBagOfChips(syncable::Directory* dir,
102 sync_pb::ClientToServerMessage* msg);
103
104
95 // Set the protocol version field in the outgoing message. 105 // Set the protocol version field in the outgoing message.
96 static void SetProtocolVersion(sync_pb::ClientToServerMessage* msg); 106 static void SetProtocolVersion(sync_pb::ClientToServerMessage* msg);
97 107
98 private: 108 private:
99 SyncerProtoUtil() {} 109 SyncerProtoUtil() {}
100 110
101 // Helper functions for PostClientToServerMessage. 111 // Helper functions for PostClientToServerMessage.
102 112
103 // Verifies the store birthday, alerting/resetting as appropriate if there's a 113 // Verifies the store birthday, alerting/resetting as appropriate if there's a
104 // mismatch. Return false if the syncer should be stuck. 114 // mismatch. Return false if the syncer should be stuck.
(...skipping 28 matching lines...) Expand all
133 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); 143 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday);
134 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); 144 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes);
135 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); 145 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes);
136 146
137 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); 147 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil);
138 }; 148 };
139 149
140 } // namespace syncer 150 } // namespace syncer
141 151
142 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ 152 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_
OLDNEW
« no previous file with comments | « sync/engine/download_updates_command.cc ('k') | sync/engine/syncer_proto_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698