| OLD | NEW |
| 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 // 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 SYNC_INTERNAL_API_ALL_STATUS_H_ | 8 #ifndef SYNC_INTERNAL_API_ALL_STATUS_H_ |
| 9 #define SYNC_INTERNAL_API_ALL_STATUS_H_ | 9 #define SYNC_INTERNAL_API_ALL_STATUS_H_ |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // we will continue to collect data and update state mid-sync-cycle in case we | 33 // we will continue to collect data and update state mid-sync-cycle in case we |
| 34 // need to debug slow or stuck sync cycles. | 34 // need to debug slow or stuck sync cycles. |
| 35 class AllStatus : public SyncEngineEventListener { | 35 class AllStatus : public SyncEngineEventListener { |
| 36 friend class ScopedStatusLock; | 36 friend class ScopedStatusLock; |
| 37 public: | 37 public: |
| 38 AllStatus(); | 38 AllStatus(); |
| 39 virtual ~AllStatus(); | 39 virtual ~AllStatus(); |
| 40 | 40 |
| 41 virtual void OnSyncEngineEvent(const SyncEngineEvent& event) OVERRIDE; | 41 virtual void OnSyncEngineEvent(const SyncEngineEvent& event) OVERRIDE; |
| 42 | 42 |
| 43 syncer::SyncStatus status() const; | 43 SyncStatus status() const; |
| 44 | 44 |
| 45 void SetNotificationsEnabled(bool notifications_enabled); | 45 void SetNotificationsEnabled(bool notifications_enabled); |
| 46 | 46 |
| 47 void IncrementNotifiableCommits(); | 47 void IncrementNotifiableCommits(); |
| 48 | 48 |
| 49 void IncrementNotificationsReceived(); | 49 void IncrementNotificationsReceived(); |
| 50 | 50 |
| 51 void SetThrottledTypes(const syncer::ModelTypeSet &types); | 51 void SetThrottledTypes(const ModelTypeSet &types); |
| 52 | 52 |
| 53 void SetEncryptedTypes(syncer::ModelTypeSet types); | 53 void SetEncryptedTypes(ModelTypeSet types); |
| 54 void SetCryptographerReady(bool ready); | 54 void SetCryptographerReady(bool ready); |
| 55 void SetCryptoHasPendingKeys(bool has_pending_keys); | 55 void SetCryptoHasPendingKeys(bool has_pending_keys); |
| 56 | 56 |
| 57 void SetUniqueId(const std::string& guid); | 57 void SetUniqueId(const std::string& guid); |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 // Examines syncer to calculate syncing and the unsynced count, | 60 // Examines syncer to calculate syncing and the unsynced count, |
| 61 // and returns a Status with new values. | 61 // and returns a Status with new values. |
| 62 syncer::SyncStatus CalcSyncing(const SyncEngineEvent& event) const; | 62 SyncStatus CalcSyncing(const SyncEngineEvent& event) const; |
| 63 syncer::SyncStatus CreateBlankStatus() const; | 63 SyncStatus CreateBlankStatus() const; |
| 64 | 64 |
| 65 syncer::SyncStatus status_; | 65 SyncStatus status_; |
| 66 | 66 |
| 67 mutable base::Lock mutex_; // Protects all data members. | 67 mutable base::Lock mutex_; // Protects all data members. |
| 68 DISALLOW_COPY_AND_ASSIGN(AllStatus); | 68 DISALLOW_COPY_AND_ASSIGN(AllStatus); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 class ScopedStatusLock { | 71 class ScopedStatusLock { |
| 72 public: | 72 public: |
| 73 explicit ScopedStatusLock(AllStatus* allstatus); | 73 explicit ScopedStatusLock(AllStatus* allstatus); |
| 74 ~ScopedStatusLock(); | 74 ~ScopedStatusLock(); |
| 75 protected: | 75 protected: |
| 76 AllStatus* allstatus_; | 76 AllStatus* allstatus_; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // namespace syncer | 79 } // namespace syncer |
| 80 | 80 |
| 81 #endif // SYNC_INTERNAL_API_ALL_STATUS_H_ | 81 #endif // SYNC_INTERNAL_API_ALL_STATUS_H_ |
| OLD | NEW |