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

Side by Side Diff: sync/sessions/data_type_tracker.h

Issue 322333004: sync: Inject sync/'s dependency on invalidations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing files Created 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // A class to track the per-type scheduling data. 5 // A class to track the per-type scheduling data.
6 #ifndef SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ 6 #ifndef SYNC_SESSIONS_DATA_TYPE_TRACKER_H_
7 #define SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ 7 #define SYNC_SESSIONS_DATA_TYPE_TRACKER_H_
8 8
9 #include <deque> 9 #include <list>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h"
13 #include "base/time/time.h" 15 #include "base/time/time.h"
14 #include "sync/notifier/dropped_invalidation_tracker.h" 16 #include "sync/internal_api/public/base/invalidation_interface.h"
15 #include "sync/notifier/single_object_invalidation_set.h" 17 #include "sync/internal_api/public/base/model_type.h"
16 #include "sync/protocol/sync.pb.h" 18 #include "sync/protocol/sync.pb.h"
17 19
18 namespace syncer { 20 namespace syncer {
19 21
20 class Invalidation; 22 class InvalidationInterface;
21 class SingleObjectInvalidationSet;
22 23
23 namespace sessions { 24 namespace sessions {
24 25
25 typedef std::deque<std::string> PayloadList;
26
27 class DataTypeTracker { 26 class DataTypeTracker {
28 public: 27 public:
29 explicit DataTypeTracker(const invalidation::ObjectId& object_id); 28 explicit DataTypeTracker();
30 ~DataTypeTracker(); 29 ~DataTypeTracker();
31 30
32 // For STL compatibility, we do not forbid the creation of a default copy 31 // For STL compatibility, we do not forbid the creation of a default copy
33 // constructor and assignment operator. 32 // constructor and assignment operator.
34 33
35 // Tracks that a local change has been made to this type. 34 // Tracks that a local change has been made to this type.
36 void RecordLocalChange(); 35 void RecordLocalChange();
37 36
38 // Tracks that a local refresh request has been made for this type. 37 // Tracks that a local refresh request has been made for this type.
39 void RecordLocalRefreshRequest(); 38 void RecordLocalRefreshRequest();
40 39
41 // Tracks that we received invalidation notifications for this type. 40 // Tracks that we received invalidation notifications for this type.
42 void RecordRemoteInvalidations( 41 void RecordRemoteInvalidation(scoped_ptr<InvalidationInterface> incoming);
43 const SingleObjectInvalidationSet& invalidations);
44 42
45 // Records that a sync cycle has been performed successfully. 43 // Records that a sync cycle has been performed successfully.
46 // Generally, this means that all local changes have been committed and all 44 // Generally, this means that all local changes have been committed and all
47 // remote changes have been downloaded, so we can clear any flags related to 45 // remote changes have been downloaded, so we can clear any flags related to
48 // pending work. 46 // pending work.
49 void RecordSuccessfulSyncCycle(); 47 void RecordSuccessfulSyncCycle();
50 48
51 // Updates the size of the invalidations payload buffer. 49 // Updates the size of the invalidations payload buffer.
52 void UpdatePayloadBufferSize(size_t new_size); 50 void UpdatePayloadBufferSize(size_t new_size);
53 51
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // successful sync cycle. 96 // successful sync cycle.
99 int local_nudge_count_; 97 int local_nudge_count_;
100 98
101 // Number of local refresh requests received for this type since the last 99 // Number of local refresh requests received for this type since the last
102 // successful sync cycle. 100 // successful sync cycle.
103 int local_refresh_request_count_; 101 int local_refresh_request_count_;
104 102
105 // The list of invalidations received since the last successful sync cycle. 103 // The list of invalidations received since the last successful sync cycle.
106 // This list may be incomplete. See also: 104 // This list may be incomplete. See also:
107 // drop_tracker_.IsRecoveringFromDropEvent() and server_payload_overflow_. 105 // drop_tracker_.IsRecoveringFromDropEvent() and server_payload_overflow_.
108 SingleObjectInvalidationSet pending_invalidations_; 106 std::list<scoped_ptr<InvalidationInterface> > pending_invalidations_;
109 107
110 size_t payload_buffer_size_; 108 size_t payload_buffer_size_;
111 109
112 // If !unthrottle_time_.is_null(), this type is throttled and may not download 110 // If !unthrottle_time_.is_null(), this type is throttled and may not download
113 // or commit data until the specified time. 111 // or commit data until the specified time.
114 base::TimeTicks unthrottle_time_; 112 base::TimeTicks unthrottle_time_;
115 113
116 // A helper to keep track invalidations we dropped due to overflow. 114 // A helper to keep track invalidations we dropped due to overflow.
117 DroppedInvalidationTracker drop_tracker_; 115 scoped_ptr<InvalidationInterface> last_dropped_invalidation_;
116
117 DISALLOW_COPY_AND_ASSIGN(DataTypeTracker);
118 }; 118 };
119 119
120 } // namespace sessions
120 } // namespace syncer 121 } // namespace syncer
121 } // namespace sessions
122 122
123 #endif // SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ 123 #endif // SYNC_SESSIONS_DATA_TYPE_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698