| OLD | NEW |
| 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 outstanding work required to bring the client back into | 5 // A class to track the outstanding work required to bring the client back into |
| 6 // sync with the server. | 6 // sync with the server. |
| 7 #ifndef SYNC_SESSIONS_NUDGE_TRACKER_H_ | 7 #ifndef SYNC_SESSIONS_NUDGE_TRACKER_H_ |
| 8 #define SYNC_SESSIONS_NUDGE_TRACKER_H_ | 8 #define SYNC_SESSIONS_NUDGE_TRACKER_H_ |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <map> | 11 #include <map> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "sync/base/sync_export.h" | 14 #include "sync/base/sync_export.h" |
| 15 #include "sync/internal_api/public/base/model_type.h" | 15 #include "sync/internal_api/public/base/model_type.h" |
| 16 #include "sync/internal_api/public/base/model_type_invalidation_map.h" | 16 #include "sync/internal_api/public/base/model_type_invalidation_map.h" |
| 17 #include "sync/protocol/sync.pb.h" | 17 #include "sync/protocol/sync.pb.h" |
| 18 #include "sync/sessions/data_type_tracker.h" | 18 #include "sync/sessions/data_type_tracker.h" |
| 19 | 19 |
| 20 namespace syncer { | 20 namespace syncer { |
| 21 namespace sessions { | 21 namespace sessions { |
| 22 | 22 |
| 23 struct SyncSourceInfo; | |
| 24 | |
| 25 class SYNC_EXPORT_PRIVATE NudgeTracker { | 23 class SYNC_EXPORT_PRIVATE NudgeTracker { |
| 26 public: | 24 public: |
| 27 static size_t kDefaultMaxPayloadsPerType; | 25 static size_t kDefaultMaxPayloadsPerType; |
| 28 | 26 |
| 29 NudgeTracker(); | 27 NudgeTracker(); |
| 30 ~NudgeTracker(); | 28 ~NudgeTracker(); |
| 31 | 29 |
| 32 // Returns true if there is a good reason for performing a sync cycle. | 30 // Returns true if there is a good reason for performing a sync cycle. |
| 33 // This does not take into account whether or not this is a good *time* to | 31 // This does not take into account whether or not this is a good *time* to |
| 34 // perform a sync cycle; that's the scheduler's job. | 32 // perform a sync cycle; that's the scheduler's job. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 69 |
| 72 // Returns true if any type is currenlty throttled. | 70 // Returns true if any type is currenlty throttled. |
| 73 bool IsAnyTypeThrottled() const; | 71 bool IsAnyTypeThrottled() const; |
| 74 | 72 |
| 75 // Returns true if |type| is currently throttled. | 73 // Returns true if |type| is currently throttled. |
| 76 bool IsTypeThrottled(ModelType type) const; | 74 bool IsTypeThrottled(ModelType type) const; |
| 77 | 75 |
| 78 // Returns the set of currently throttled types. | 76 // Returns the set of currently throttled types. |
| 79 ModelTypeSet GetThrottledTypes() const; | 77 ModelTypeSet GetThrottledTypes() const; |
| 80 | 78 |
| 81 // A helper to return an old-style source info. Used only to maintain | |
| 82 // compatibility with some old code. | |
| 83 SyncSourceInfo GetSourceInfo() const; | |
| 84 | |
| 85 // Returns the 'source' of the GetUpdate request. | 79 // Returns the 'source' of the GetUpdate request. |
| 86 // | 80 // |
| 87 // This flag is deprecated, but still used by the server. There can be more | 81 // This flag is deprecated, but still used by the server. There can be more |
| 88 // than one reason to perform a particular sync cycle. The GetUpdatesTrigger | 82 // than one reason to perform a particular sync cycle. The GetUpdatesTrigger |
| 89 // message will contain more reliable information about the reasons for | 83 // message will contain more reliable information about the reasons for |
| 90 // performing a sync. | 84 // performing a sync. |
| 91 // | 85 // |
| 92 // See the implementation for important information about the coalesce logic. | 86 // See the implementation for important information about the coalesce logic. |
| 93 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source() const; | 87 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source() const; |
| 94 | 88 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 128 |
| 135 size_t num_payloads_per_type_; | 129 size_t num_payloads_per_type_; |
| 136 | 130 |
| 137 DISALLOW_COPY_AND_ASSIGN(NudgeTracker); | 131 DISALLOW_COPY_AND_ASSIGN(NudgeTracker); |
| 138 }; | 132 }; |
| 139 | 133 |
| 140 } // namespace sessions | 134 } // namespace sessions |
| 141 } // namespace syncer | 135 } // namespace syncer |
| 142 | 136 |
| 143 #endif // SYNC_SESSIONS_NUDGE_TRACKER_H_ | 137 #endif // SYNC_SESSIONS_NUDGE_TRACKER_H_ |
| OLD | NEW |