Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: sync/engine/all_status.h

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/api/syncable_service.cc ('k') | sync/engine/all_status.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #pragma once 10 #pragma once
11 11
12 #include <map> 12 #include <map>
13 #include <string> 13 #include <string>
14 14
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "sync/engine/sync_engine_event.h" 17 #include "sync/engine/sync_engine_event.h"
18 #include "sync/engine/syncer_types.h" 18 #include "sync/engine/syncer_types.h"
19 #include "sync/internal_api/public/engine/sync_status.h" 19 #include "sync/internal_api/public/engine/sync_status.h"
20 #include "sync/internal_api/public/syncable/model_type.h" 20 #include "sync/internal_api/public/syncable/model_type.h"
21 21
22 namespace csync { 22 namespace syncer {
23 23
24 class ScopedStatusLock; 24 class ScopedStatusLock;
25 struct ServerConnectionEvent; 25 struct ServerConnectionEvent;
26 26
27 // This class collects data and uses it to update its internal state. It can 27 // This class collects data and uses it to update its internal state. It can
28 // return a snapshot of this state as a SyncerStatus object. 28 // return a snapshot of this state as a SyncerStatus object.
29 // 29 //
30 // Most of this data ends up on the about:sync page. But the page is only 30 // Most of this data ends up on the about:sync page. But the page is only
31 // 'pinged' to update itself at the end of a sync cycle. A user could refresh 31 // 'pinged' to update itself at the end of a sync cycle. A user could refresh
32 // manually, but unless their timing is excellent it's unlikely that a user will 32 // manually, but unless their timing is excellent it's unlikely that a user will
33 // see any state in mid-sync cycle. We have no plans to change this. However, 33 // see any state in mid-sync cycle. We have no plans to change this. However,
34 // we will continue to collect data and update state mid-sync-cycle in case we 34 // we will continue to collect data and update state mid-sync-cycle in case we
35 // need to debug slow or stuck sync cycles. 35 // need to debug slow or stuck sync cycles.
36 class AllStatus : public SyncEngineEventListener { 36 class AllStatus : public SyncEngineEventListener {
37 friend class ScopedStatusLock; 37 friend class ScopedStatusLock;
38 public: 38 public:
39 AllStatus(); 39 AllStatus();
40 virtual ~AllStatus(); 40 virtual ~AllStatus();
41 41
42 virtual void OnSyncEngineEvent(const SyncEngineEvent& event) OVERRIDE; 42 virtual void OnSyncEngineEvent(const SyncEngineEvent& event) OVERRIDE;
43 43
44 csync::SyncStatus status() const; 44 syncer::SyncStatus status() const;
45 45
46 void SetNotificationsEnabled(bool notifications_enabled); 46 void SetNotificationsEnabled(bool notifications_enabled);
47 47
48 void IncrementNotifiableCommits(); 48 void IncrementNotifiableCommits();
49 49
50 void IncrementNotificationsReceived(); 50 void IncrementNotificationsReceived();
51 51
52 void SetThrottledTypes(const syncable::ModelTypeSet &types); 52 void SetThrottledTypes(const syncable::ModelTypeSet &types);
53 53
54 void SetEncryptedTypes(syncable::ModelTypeSet types); 54 void SetEncryptedTypes(syncable::ModelTypeSet types);
55 void SetCryptographerReady(bool ready); 55 void SetCryptographerReady(bool ready);
56 void SetCryptoHasPendingKeys(bool has_pending_keys); 56 void SetCryptoHasPendingKeys(bool has_pending_keys);
57 57
58 void SetUniqueId(const std::string& guid); 58 void SetUniqueId(const std::string& guid);
59 59
60 protected: 60 protected:
61 // Examines syncer to calculate syncing and the unsynced count, 61 // Examines syncer to calculate syncing and the unsynced count,
62 // and returns a Status with new values. 62 // and returns a Status with new values.
63 csync::SyncStatus CalcSyncing(const SyncEngineEvent& event) const; 63 syncer::SyncStatus CalcSyncing(const SyncEngineEvent& event) const;
64 csync::SyncStatus CreateBlankStatus() const; 64 syncer::SyncStatus CreateBlankStatus() const;
65 65
66 csync::SyncStatus status_; 66 syncer::SyncStatus status_;
67 67
68 mutable base::Lock mutex_; // Protects all data members. 68 mutable base::Lock mutex_; // Protects all data members.
69 DISALLOW_COPY_AND_ASSIGN(AllStatus); 69 DISALLOW_COPY_AND_ASSIGN(AllStatus);
70 }; 70 };
71 71
72 class ScopedStatusLock { 72 class ScopedStatusLock {
73 public: 73 public:
74 explicit ScopedStatusLock(AllStatus* allstatus); 74 explicit ScopedStatusLock(AllStatus* allstatus);
75 ~ScopedStatusLock(); 75 ~ScopedStatusLock();
76 protected: 76 protected:
77 AllStatus* allstatus_; 77 AllStatus* allstatus_;
78 }; 78 };
79 79
80 } // namespace csync 80 } // namespace syncer
81 81
82 #endif // SYNC_INTERNAL_API_ALL_STATUS_H_ 82 #endif // SYNC_INTERNAL_API_ALL_STATUS_H_
OLDNEW
« no previous file with comments | « sync/api/syncable_service.cc ('k') | sync/engine/all_status.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698