| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
| 6 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 6 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/sync/engine/syncer_session.h" | |
| 11 #include "chrome/browser/sync/syncable/blob.h" | 10 #include "chrome/browser/sync/syncable/blob.h" |
| 12 #include "chrome/browser/sync/util/sync_types.h" | 11 #include "chrome/browser/sync/util/sync_types.h" |
| 13 | 12 |
| 14 namespace syncable { | 13 namespace syncable { |
| 15 class Entry; | 14 class Entry; |
| 16 class ScopedDirLookup; | 15 class ScopedDirLookup; |
| 17 class SyncName; | 16 class SyncName; |
| 18 } // namespace syncable | 17 } // namespace syncable |
| 19 | 18 |
| 20 namespace sync_pb { | 19 namespace sync_pb { |
| 21 class ClientToServerResponse; | 20 class ClientToServerResponse; |
| 22 } // namespace sync_pb | 21 } // namespace sync_pb |
| 23 | 22 |
| 24 namespace browser_sync { | 23 namespace browser_sync { |
| 25 | 24 |
| 25 namespace sessions { |
| 26 class SyncSession; |
| 27 } |
| 28 |
| 26 class ClientToServerMessage; | 29 class ClientToServerMessage; |
| 27 class SyncerSession; | |
| 28 class SyncEntity; | 30 class SyncEntity; |
| 29 class CommitResponse_EntryResponse; | 31 class CommitResponse_EntryResponse; |
| 30 | 32 |
| 31 class SyncerProtoUtil { | 33 class SyncerProtoUtil { |
| 32 public: | 34 public: |
| 33 // Posts the given message and fills the buffer with the returned value. | 35 // Posts the given message and fills the buffer with the returned value. |
| 34 // Returns true on success. Also handles store birthday verification: | 36 // Returns true on success. Also handles store birthday verification: |
| 35 // session->status()->syncer_stuck_ is set true if the birthday is | 37 // session->status()->syncer_stuck_ is set true if the birthday is |
| 36 // incorrect. A false value will always be returned if birthday is bad. | 38 // incorrect. A false value will always be returned if birthday is bad. |
| 37 static bool PostClientToServerMessage(ClientToServerMessage* msg, | 39 static bool PostClientToServerMessage(ClientToServerMessage* msg, |
| 38 sync_pb::ClientToServerResponse* response, SyncerSession* session); | 40 sync_pb::ClientToServerResponse* response, |
| 41 sessions::SyncSession* session); |
| 39 | 42 |
| 40 // Compares a syncable Entry to SyncEntity, returns true iff the data is | 43 // Compares a syncable Entry to SyncEntity, returns true iff the data is |
| 41 // identical. | 44 // identical. |
| 42 // | 45 // |
| 43 // TODO(sync): The places where this function is used are arguable big causes | 46 // TODO(sync): The places where this function is used are arguable big causes |
| 44 // of the fragility, because there's a tendency to freak out the moment the | 47 // of the fragility, because there's a tendency to freak out the moment the |
| 45 // local and server values diverge. However, this almost always indicates a | 48 // local and server values diverge. However, this almost always indicates a |
| 46 // sync bug somewhere earlier in the sync cycle. | 49 // sync bug somewhere earlier in the sync cycle. |
| 47 static bool Compare(const syncable::Entry& local_entry, | 50 static bool Compare(const syncable::Entry& local_entry, |
| 48 const SyncEntity& server_entry); | 51 const SyncEntity& server_entry); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 65 const CommitResponse_EntryResponse& entry); | 68 const CommitResponse_EntryResponse& entry); |
| 66 | 69 |
| 67 private: | 70 private: |
| 68 SyncerProtoUtil() {} | 71 SyncerProtoUtil() {} |
| 69 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); | 72 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); |
| 70 }; | 73 }; |
| 71 | 74 |
| 72 } // namespace browser_sync | 75 } // namespace browser_sync |
| 73 | 76 |
| 74 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 77 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
| OLD | NEW |