| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // The AllStatus object watches various sync engine components and aggregates | 5 // The AllStatus object watches various sync engine components and aggregates |
| 6 // the status of all of them into one place. | 6 // the status of all of them into one place. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ | 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ |
| 9 #define CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ | 9 #define CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 // Contains current transfer item meta handle | 81 // Contains current transfer item meta handle |
| 82 int64 current_item_meta_handle; | 82 int64 current_item_meta_handle; |
| 83 // The next two values will be equal if all updates have been received. | 83 // The next two values will be equal if all updates have been received. |
| 84 // total updates available. | 84 // total updates available. |
| 85 int64 updates_available; | 85 int64 updates_available; |
| 86 // total updates received. | 86 // total updates received. |
| 87 int64 updates_received; | 87 int64 updates_received; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 // Maximum interval for exponential backoff. | |
| 91 static const int kMaxBackoffSeconds; | |
| 92 | |
| 93 AllStatus(); | 90 AllStatus(); |
| 94 ~AllStatus(); | 91 ~AllStatus(); |
| 95 | 92 |
| 96 void WatchConnectionManager(ServerConnectionManager* conn_mgr); | 93 void WatchConnectionManager(ServerConnectionManager* conn_mgr); |
| 97 void HandleServerConnectionEvent(const ServerConnectionEvent& event); | 94 void HandleServerConnectionEvent(const ServerConnectionEvent& event); |
| 98 | 95 |
| 99 void HandleAuthWatcherEvent(const AuthWatcherEvent& event); | 96 void HandleAuthWatcherEvent(const AuthWatcherEvent& event); |
| 100 | 97 |
| 101 void WatchSyncerThread(SyncerThread* syncer_thread); | 98 void WatchSyncerThread(SyncerThread* syncer_thread); |
| 102 void HandleChannelEvent(const SyncerEvent& event); | 99 void HandleChannelEvent(const SyncerEvent& event); |
| 103 | 100 |
| 104 // Returns a string description of the SyncStatus (currently just the ascii | 101 // Returns a string description of the SyncStatus (currently just the ascii |
| 105 // version of the enum). Will LOG(FATAL) if the status us out of range. | 102 // version of the enum). Will LOG(FATAL) if the status us out of range. |
| 106 static const char* GetSyncStatusString(SyncStatus status); | 103 static const char* GetSyncStatusString(SyncStatus status); |
| 107 | 104 |
| 108 Channel* channel() const { return channel_; } | 105 Channel* channel() const { return channel_; } |
| 109 | 106 |
| 110 Status status() const; | 107 Status status() const; |
| 111 | 108 |
| 112 // DDOS avoidance function. The argument and return value is in seconds | |
| 113 static int GetRecommendedDelaySeconds(int base_delay_seconds); | |
| 114 | |
| 115 // This uses AllStatus' max_consecutive_errors as the error count | |
| 116 int GetRecommendedDelay(int base_delay) const; | |
| 117 | |
| 118 void SetNotificationsEnabled(bool notifications_enabled); | 109 void SetNotificationsEnabled(bool notifications_enabled); |
| 119 | 110 |
| 120 void IncrementNotificationsSent(); | 111 void IncrementNotificationsSent(); |
| 121 | 112 |
| 122 void IncrementNotificationsReceived(); | 113 void IncrementNotificationsReceived(); |
| 123 | 114 |
| 124 protected: | 115 protected: |
| 125 typedef std::map<Syncer*, EventListenerHookup*> Syncers; | 116 typedef std::map<Syncer*, EventListenerHookup*> Syncers; |
| 126 | 117 |
| 127 // Examines syncer to calculate syncing and the unsynced count, | 118 // Examines syncer to calculate syncing and the unsynced count, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 void NotifyOverQuota(); | 179 void NotifyOverQuota(); |
| 189 protected: | 180 protected: |
| 190 AllStatusEvent event_; | 181 AllStatusEvent event_; |
| 191 AllStatus* const allstatus_; | 182 AllStatus* const allstatus_; |
| 192 StatusNotifyPlan plan_; | 183 StatusNotifyPlan plan_; |
| 193 }; | 184 }; |
| 194 | 185 |
| 195 } // namespace browser_sync | 186 } // namespace browser_sync |
| 196 | 187 |
| 197 #endif // CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ | 188 #endif // CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ |
| OLD | NEW |