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 |
11 | 11 |
12 #include <map> | 12 #include <map> |
13 | 13 |
14 #include "base/lock.h" | |
15 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 15 #include "base/synchronization/lock.h" |
16 #include "chrome/browser/sync/engine/syncer_types.h" | 16 #include "chrome/browser/sync/engine/syncer_types.h" |
17 | 17 |
18 namespace browser_sync { | 18 namespace browser_sync { |
19 | 19 |
20 class ScopedStatusLock; | 20 class ScopedStatusLock; |
21 class ServerConnectionManager; | 21 class ServerConnectionManager; |
22 class Syncer; | 22 class Syncer; |
23 class SyncerThread; | 23 class SyncerThread; |
24 struct AuthWatcherEvent; | 24 struct AuthWatcherEvent; |
25 struct ServerConnectionEvent; | 25 struct ServerConnectionEvent; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // Examines syncer to calculate syncing and the unsynced count, | 106 // Examines syncer to calculate syncing and the unsynced count, |
107 // and returns a Status with new values. | 107 // and returns a Status with new values. |
108 Status CalcSyncing(const SyncEngineEvent& event) const; | 108 Status CalcSyncing(const SyncEngineEvent& event) const; |
109 Status CreateBlankStatus() const; | 109 Status CreateBlankStatus() const; |
110 | 110 |
111 // Examines status to see what has changed, updates old_status in place. | 111 // Examines status to see what has changed, updates old_status in place. |
112 void CalcStatusChanges(); | 112 void CalcStatusChanges(); |
113 | 113 |
114 Status status_; | 114 Status status_; |
115 | 115 |
116 mutable Lock mutex_; // Protects all data members. | 116 mutable base::Lock mutex_; // Protects all data members. |
117 DISALLOW_COPY_AND_ASSIGN(AllStatus); | 117 DISALLOW_COPY_AND_ASSIGN(AllStatus); |
118 }; | 118 }; |
119 | 119 |
120 class ScopedStatusLock { | 120 class ScopedStatusLock { |
121 public: | 121 public: |
122 explicit ScopedStatusLock(AllStatus* allstatus); | 122 explicit ScopedStatusLock(AllStatus* allstatus); |
123 ~ScopedStatusLock(); | 123 ~ScopedStatusLock(); |
124 protected: | 124 protected: |
125 AllStatus* allstatus_; | 125 AllStatus* allstatus_; |
126 }; | 126 }; |
127 | 127 |
128 } // namespace browser_sync | 128 } // namespace browser_sync |
129 | 129 |
130 #endif // CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ | 130 #endif // CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ |
OLD | NEW |