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

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: 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
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 an eventual bag of chips sent by the server.
Nicolas Zea 2012/09/07 18:38:43 "Persist a bag of chips"? Not sure what you mean b
qsr 2012/09/10 08:12:37 I mean that if there is not bag of chips, nothing
78 static void PersistBagOfChips(syncable::Directory* dir,
Nicolas Zea 2012/09/07 18:38:43 nit: move first param onto new line so they line u
qsr 2012/09/10 08:12:37 Done, but I followed the style of the next method.
79 const sync_pb::ClientToServerResponse& response);
80
77 // EntitySpecifics is used as a filter for the GetUpdates message to tell 81 // 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 82 // the server which datatypes to send back. This adds a datatype so that
79 // it's included in the filter. 83 // it's included in the filter.
80 static void AddToEntitySpecificDatatypesFilter(ModelType datatype, 84 static void AddToEntitySpecificDatatypesFilter(ModelType datatype,
81 sync_pb::EntitySpecifics* filter); 85 sync_pb::EntitySpecifics* filter);
82 86
83 // Get a debug string representation of the client to server response. 87 // Get a debug string representation of the client to server response.
84 static std::string ClientToServerResponseDebugString( 88 static std::string ClientToServerResponseDebugString(
85 const sync_pb::ClientToServerResponse& response); 89 const sync_pb::ClientToServerResponse& response);
86 90
87 // Get update contents as a string. Intended for logging, and intended 91 // 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. 92 // to have a smaller footprint than the protobuf's built-in pretty printer.
89 static std::string SyncEntityDebugString(const sync_pb::SyncEntity& entry); 93 static std::string SyncEntityDebugString(const sync_pb::SyncEntity& entry);
90 94
91 // Pull the birthday from the dir and put it into the msg. 95 // Pull the birthday from the dir and put it into the msg.
92 static void AddRequestBirthday(syncable::Directory* dir, 96 static void AddRequestBirthday(syncable::Directory* dir,
93 sync_pb::ClientToServerMessage* msg); 97 sync_pb::ClientToServerMessage* msg);
94 98
99 // Pull the bag of chips from the dir and put it into the msg.
100 static void AddBagOfChips(syncable::Directory* dir,
101 sync_pb::ClientToServerMessage* msg);
102
103
95 // Set the protocol version field in the outgoing message. 104 // Set the protocol version field in the outgoing message.
96 static void SetProtocolVersion(sync_pb::ClientToServerMessage* msg); 105 static void SetProtocolVersion(sync_pb::ClientToServerMessage* msg);
97 106
98 private: 107 private:
99 SyncerProtoUtil() {} 108 SyncerProtoUtil() {}
100 109
101 // Helper functions for PostClientToServerMessage. 110 // Helper functions for PostClientToServerMessage.
102 111
103 // Verifies the store birthday, alerting/resetting as appropriate if there's a 112 // Verifies the store birthday, alerting/resetting as appropriate if there's a
104 // mismatch. Return false if the syncer should be stuck. 113 // mismatch. Return false if the syncer should be stuck.
(...skipping 28 matching lines...) Expand all
133 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); 142 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday);
134 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); 143 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes);
135 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); 144 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes);
136 145
137 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); 146 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil);
138 }; 147 };
139 148
140 } // namespace syncer 149 } // namespace syncer
141 150
142 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ 151 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698