| OLD | NEW |
| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } // namespace sync_pb | 26 } // namespace sync_pb |
| 27 | 27 |
| 28 namespace browser_sync { | 28 namespace browser_sync { |
| 29 | 29 |
| 30 namespace sessions { | 30 namespace sessions { |
| 31 class SyncProtocolError; | 31 class SyncProtocolError; |
| 32 class SyncSessionContext; | 32 class SyncSessionContext; |
| 33 } | 33 } |
| 34 | 34 |
| 35 class ClientToServerMessage; | 35 class ClientToServerMessage; |
| 36 class ThrottledDataTypeTracker; |
| 36 class ServerConnectionManager; | 37 class ServerConnectionManager; |
| 37 class SyncEntity; | 38 class SyncEntity; |
| 38 class CommitResponse_EntryResponse; | 39 class CommitResponse_EntryResponse; |
| 39 | 40 |
| 40 class SyncerProtoUtil { | 41 class SyncerProtoUtil { |
| 41 public: | 42 public: |
| 42 // Posts the given message and fills the buffer with the returned value. | 43 // Posts the given message and fills the buffer with the returned value. |
| 43 // Returns true on success. Also handles store birthday verification: will | 44 // Returns true on success. Also handles store birthday verification: will |
| 44 // produce a SyncError if the birthday is incorrect. | 45 // produce a SyncError if the birthday is incorrect. |
| 45 static SyncerError PostClientToServerMessage( | 46 static SyncerError PostClientToServerMessage( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // Post the message using the scm, and do some processing on the returned | 112 // Post the message using the scm, and do some processing on the returned |
| 112 // headers. Decode the server response. | 113 // headers. Decode the server response. |
| 113 static bool PostAndProcessHeaders(browser_sync::ServerConnectionManager* scm, | 114 static bool PostAndProcessHeaders(browser_sync::ServerConnectionManager* scm, |
| 114 sessions::SyncSession* session, | 115 sessions::SyncSession* session, |
| 115 const ClientToServerMessage& msg, | 116 const ClientToServerMessage& msg, |
| 116 sync_pb::ClientToServerResponse* response); | 117 sync_pb::ClientToServerResponse* response); |
| 117 | 118 |
| 118 static base::TimeDelta GetThrottleDelay( | 119 static base::TimeDelta GetThrottleDelay( |
| 119 const sync_pb::ClientToServerResponse& response); | 120 const sync_pb::ClientToServerResponse& response); |
| 120 | 121 |
| 121 static void HandleThrottleError(const SyncProtocolError& error, | 122 static void HandleThrottleError( |
| 122 const base::TimeTicks& throttled_until, | 123 const SyncProtocolError& error, |
| 123 sessions::SyncSessionContext* context, | 124 const base::TimeTicks& throttled_until, |
| 124 sessions::SyncSession::Delegate* delegate); | 125 browser_sync::ThrottledDataTypeTracker* tracker, |
| 126 sessions::SyncSession::Delegate* delegate); |
| 125 | 127 |
| 126 friend class SyncerProtoUtilTest; | 128 friend class SyncerProtoUtilTest; |
| 127 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, AddRequestBirthday); | 129 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, AddRequestBirthday); |
| 128 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, PostAndProcessHeaders); | 130 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, PostAndProcessHeaders); |
| 129 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); | 131 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); |
| 130 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); | 132 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); |
| 131 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); | 133 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); |
| 132 | 134 |
| 133 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); | 135 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); |
| 134 }; | 136 }; |
| 135 | 137 |
| 136 } // namespace browser_sync | 138 } // namespace browser_sync |
| 137 | 139 |
| 138 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 140 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
| OLD | NEW |