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

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

Issue 10454105: sync: Refactor per-datatype throttling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up and rebased Created 8 years, 6 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 15 matching lines...) Expand all
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(const SyncProtocolError& error,
122 const base::TimeTicks& throttled_until, 123 const base::TimeTicks& throttled_until,
123 sessions::SyncSessionContext* context, 124 browser_sync::ThrottledDataTypeTracker* dttm,
124 sessions::SyncSession::Delegate* delegate); 125 sessions::SyncSession::Delegate* delegate);
125 126
126 friend class SyncerProtoUtilTest; 127 friend class SyncerProtoUtilTest;
127 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, AddRequestBirthday); 128 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, AddRequestBirthday);
128 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, PostAndProcessHeaders); 129 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, PostAndProcessHeaders);
129 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); 130 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday);
130 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); 131 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes);
131 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); 132 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes);
132 133
133 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); 134 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil);
134 }; 135 };
135 136
136 } // namespace browser_sync 137 } // namespace browser_sync
137 138
138 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ 139 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698