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

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

Issue 387983004: sync: Support non-blocking initial sync in proto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + fix comment Created 6 years, 5 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 #ifndef SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ 5 #ifndef SYNC_SESSIONS_DATA_TYPE_TRACKER_H_
6 #define SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ 6 #define SYNC_SESSIONS_DATA_TYPE_TRACKER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 21 matching lines...) Expand all
32 32
33 // Tracks that a local change has been made to this type. 33 // Tracks that a local change has been made to this type.
34 void RecordLocalChange(); 34 void RecordLocalChange();
35 35
36 // Tracks that a local refresh request has been made for this type. 36 // Tracks that a local refresh request has been made for this type.
37 void RecordLocalRefreshRequest(); 37 void RecordLocalRefreshRequest();
38 38
39 // Tracks that we received invalidation notifications for this type. 39 // Tracks that we received invalidation notifications for this type.
40 void RecordRemoteInvalidation(scoped_ptr<InvalidationInterface> incoming); 40 void RecordRemoteInvalidation(scoped_ptr<InvalidationInterface> incoming);
41 41
42 // Takes note that initial sync is pending for this type.
43 void RecordInitialSyncRequired();
44
42 // Records that a sync cycle has been performed successfully. 45 // Records that a sync cycle has been performed successfully.
43 // Generally, this means that all local changes have been committed and all 46 // Generally, this means that all local changes have been committed and all
44 // remote changes have been downloaded, so we can clear any flags related to 47 // remote changes have been downloaded, so we can clear any flags related to
45 // pending work. 48 // pending work.
46 void RecordSuccessfulSyncCycle(); 49 void RecordSuccessfulSyncCycle();
47 50
48 // Updates the size of the invalidations payload buffer. 51 // Updates the size of the invalidations payload buffer.
49 void UpdatePayloadBufferSize(size_t new_size); 52 void UpdatePayloadBufferSize(size_t new_size);
50 53
51 // Returns true if there is a good reason to perform a sync cycle. This does 54 // Returns true if there is a good reason to perform a sync cycle. This does
52 // not take into account whether or not now is a good time to perform a sync 55 // not take into account whether or not now is a good time to perform a sync
53 // cycle. That's for the scheduler to decide. 56 // cycle. That's for the scheduler to decide.
54 bool IsSyncRequired() const; 57 bool IsSyncRequired() const;
55 58
56 // Returns true if there is a good reason to fetch updates for this type as 59 // Returns true if there is a good reason to fetch updates for this type as
57 // part of the next sync cycle. 60 // part of the next sync cycle.
58 bool IsGetUpdatesRequired() const; 61 bool IsGetUpdatesRequired() const;
59 62
60 // Returns true if there is an uncommitted local change. 63 // Returns true if there is an uncommitted local change.
61 bool HasLocalChangePending() const; 64 bool HasLocalChangePending() const;
62 65
63 // Returns true if we've received an invalidation since we last fetched 66 // Returns true if we've received an invalidation since we last fetched
64 // updates. 67 // updates.
65 bool HasPendingInvalidation() const; 68 bool HasPendingInvalidation() const;
66 69
67 // Returns true if an explicit refresh request is still outstanding. 70 // Returns true if an explicit refresh request is still outstanding.
68 bool HasRefreshRequestPending() const; 71 bool HasRefreshRequestPending() const;
69 72
73 // Returns true if this type is requesting an initial sync.
74 bool IsInitialSyncRequired() const;
75
70 // Fills in the legacy invalidaiton payload information fields. 76 // Fills in the legacy invalidaiton payload information fields.
71 void SetLegacyNotificationHint( 77 void SetLegacyNotificationHint(
72 sync_pb::DataTypeProgressMarker* progress) const; 78 sync_pb::DataTypeProgressMarker* progress) const;
73 79
74 // Fills some type-specific contents of a GetUpdates request protobuf. These 80 // Fills some type-specific contents of a GetUpdates request protobuf. These
75 // messages provide the server with the information it needs to decide how to 81 // messages provide the server with the information it needs to decide how to
76 // handle a request. 82 // handle a request.
77 void FillGetUpdatesTriggersMessage(sync_pb::GetUpdateTriggers* msg) const; 83 void FillGetUpdatesTriggersMessage(sync_pb::GetUpdateTriggers* msg) const;
78 84
79 // Returns true if the type is currently throttled. 85 // Returns true if the type is currently throttled.
(...skipping 21 matching lines...) Expand all
101 107
102 // The list of invalidations received since the last successful sync cycle. 108 // The list of invalidations received since the last successful sync cycle.
103 // This list may be incomplete. See also: 109 // This list may be incomplete. See also:
104 // drop_tracker_.IsRecoveringFromDropEvent() and server_payload_overflow_. 110 // drop_tracker_.IsRecoveringFromDropEvent() and server_payload_overflow_.
105 // 111 //
106 // This list takes ownership of its contents. 112 // This list takes ownership of its contents.
107 ScopedVector<InvalidationInterface> pending_invalidations_; 113 ScopedVector<InvalidationInterface> pending_invalidations_;
108 114
109 size_t payload_buffer_size_; 115 size_t payload_buffer_size_;
110 116
117 // Set to true if this type is ready for, but has not yet completed initial
118 // sync.
119 bool initial_sync_required_;
120
111 // If !unthrottle_time_.is_null(), this type is throttled and may not download 121 // If !unthrottle_time_.is_null(), this type is throttled and may not download
112 // or commit data until the specified time. 122 // or commit data until the specified time.
113 base::TimeTicks unthrottle_time_; 123 base::TimeTicks unthrottle_time_;
114 124
115 // A helper to keep track invalidations we dropped due to overflow. 125 // A helper to keep track invalidations we dropped due to overflow.
116 scoped_ptr<InvalidationInterface> last_dropped_invalidation_; 126 scoped_ptr<InvalidationInterface> last_dropped_invalidation_;
117 127
118 DISALLOW_COPY_AND_ASSIGN(DataTypeTracker); 128 DISALLOW_COPY_AND_ASSIGN(DataTypeTracker);
119 }; 129 };
120 130
121 } // namespace sessions 131 } // namespace sessions
122 } // namespace syncer 132 } // namespace syncer
123 133
124 #endif // SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ 134 #endif // SYNC_SESSIONS_DATA_TYPE_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698