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

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

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_
6 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_
7
8 #include <string>
9
10 #include "chrome/browser/sync/engine/syncer_session.h"
11 #include "chrome/browser/sync/util/sync_types.h"
12 #include "chrome/browser/sync/syncable/blob.h"
13
14 namespace syncable {
15 class Entry;
16 class ScopedDirLookup;
17 class SyncName;
18 } // namespace syncable
19
20 namespace sync_pb {
21 class ClientToServerResponse;
22 } // namespace sync_pb
23
24 namespace browser_sync {
25
26 class ClientToServerMessage;
27 class SyncerSession;
28 class SyncEntity;
29 class CommitResponse_EntryResponse;
30
31 class SyncerProtoUtil {
32 public:
33 // Posts the given message and fills the buffer with the returned value.
34 // Returns true on success. Also handles store birthday verification:
35 // session->status()->syncer_stuck_ is set true if the birthday is
36 // incorrect. A false value will always be returned if birthday is bad.
37 static bool PostClientToServerMessage(ClientToServerMessage* msg,
38 sync_pb::ClientToServerResponse* response, SyncerSession *session);
idana 2009/09/10 05:44:37 "SyncerSession *session" -> "SyncerSession* sessio
39
40 // Compares a syncable Entry to SyncEntity, returns true iff
41 // the data is identical.
42 //
43 // TODO(sync): The places where this function is used are arguable big
44 // causes of the fragility, because there's a tendency to freak out
45 // the moment the local and server values diverge. However, this almost
46 // always indicates a sync bug somewhere earlier in the sync cycle.
47 static bool Compare(const syncable::Entry& local_entry,
48 const SyncEntity& server_entry);
49
50 // Utility methods for converting between syncable::Blobs and protobuf
51 // byte fields.
52 static void CopyProtoBytesIntoBlob(const std::string& proto_bytes,
53 syncable::Blob* blob);
54 static bool ProtoBytesEqualsBlob(const std::string& proto_bytes,
55 const syncable::Blob& blob);
56 static void CopyBlobIntoProtoBytes(const syncable::Blob& blob,
57 std::string* proto_bytes);
58
59 // Extract the name fields from a sync entity.
60 static syncable::SyncName NameFromSyncEntity(
61 const SyncEntity& entry);
62
63 // Extract the name fields from a commit entry response.
64 static syncable::SyncName NameFromCommitEntryResponse(
65 const CommitResponse_EntryResponse& entry);
66
67 private:
68 SyncerProtoUtil() {}
69 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil);
70 };
idana 2009/09/10 05:44:37 Add extra blank line.
71 } // namespace browser_sync
72
73 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698