OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 29 matching lines...) Expand all Loading... |
40 void SetNotificationsEnabled(bool notifications_enabled); | 40 void SetNotificationsEnabled(bool notifications_enabled); |
41 | 41 |
42 void IncrementNotifiableCommits(); | 42 void IncrementNotifiableCommits(); |
43 | 43 |
44 void IncrementNotificationsReceived(); | 44 void IncrementNotificationsReceived(); |
45 | 45 |
46 void SetEncryptedTypes(const syncable::ModelTypeSet& types); | 46 void SetEncryptedTypes(const syncable::ModelTypeSet& types); |
47 void SetCryptographerReady(bool ready); | 47 void SetCryptographerReady(bool ready); |
48 void SetCryptoHasPendingKeys(bool has_pending_keys); | 48 void SetCryptoHasPendingKeys(bool has_pending_keys); |
49 | 49 |
50 void SetUniqueId(const std::string& guid); | |
51 | |
52 protected: | 50 protected: |
53 // Examines syncer to calculate syncing and the unsynced count, | 51 // Examines syncer to calculate syncing and the unsynced count, |
54 // and returns a Status with new values. | 52 // and returns a Status with new values. |
55 sync_api::SyncManager::Status CalcSyncing(const SyncEngineEvent& event) const; | 53 sync_api::SyncManager::Status CalcSyncing(const SyncEngineEvent& event) const; |
56 sync_api::SyncManager::Status CreateBlankStatus() const; | 54 sync_api::SyncManager::Status CreateBlankStatus() const; |
57 | 55 |
58 // Examines status to see what has changed, updates old_status in place. | 56 // Examines status to see what has changed, updates old_status in place. |
59 void CalcStatusChanges(); | 57 void CalcStatusChanges(); |
60 | 58 |
61 sync_api::SyncManager::Status status_; | 59 sync_api::SyncManager::Status status_; |
62 | 60 |
63 mutable base::Lock mutex_; // Protects all data members. | 61 mutable base::Lock mutex_; // Protects all data members. |
64 DISALLOW_COPY_AND_ASSIGN(AllStatus); | 62 DISALLOW_COPY_AND_ASSIGN(AllStatus); |
65 }; | 63 }; |
66 | 64 |
67 class ScopedStatusLock { | 65 class ScopedStatusLock { |
68 public: | 66 public: |
69 explicit ScopedStatusLock(AllStatus* allstatus); | 67 explicit ScopedStatusLock(AllStatus* allstatus); |
70 ~ScopedStatusLock(); | 68 ~ScopedStatusLock(); |
71 protected: | 69 protected: |
72 AllStatus* allstatus_; | 70 AllStatus* allstatus_; |
73 }; | 71 }; |
74 | 72 |
75 } // namespace browser_sync | 73 } // namespace browser_sync |
76 | 74 |
77 #endif // CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ | 75 #endif // CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ |
OLD | NEW |