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

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

Issue 10454105: sync: Refactor per-datatype throttling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments Created 8 years, 6 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/engine/throttled_data_type_tracker_unittest.cc ('k') | sync/internal_api/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
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // The AllStatus object watches various sync engine components and aggregates
6 // the status of all of them into one place.
7
8 #ifndef SYNC_INTERNAL_API_ALL_STATUS_H_
9 #define SYNC_INTERNAL_API_ALL_STATUS_H_
10 #pragma once
11
12 #include <map>
13 #include <string>
14
15 #include "base/compiler_specific.h"
16 #include "base/synchronization/lock.h"
17 #include "sync/engine/sync_engine_event.h"
18 #include "sync/engine/syncer_types.h"
19 #include "sync/internal_api/public/syncable/model_type.h"
20 #include "sync/internal_api/sync_manager.h"
21
22 namespace browser_sync {
23
24 class ScopedStatusLock;
25 struct ServerConnectionEvent;
26
27 // TODO(rlarocque):
28 // Most of this data ends up on the about:sync page. But the page is only
29 // 'pinged' to update itself at the end of a sync cycle. A user could refresh
30 // manually, but unless their timing is excellent it's unlikely that a user will
31 // see any state in mid-sync cycle. We have no plans to change this.
32 //
33 // What we do intend to do is improve the UI so that changes following a sync
34 // cycle are more visible. Without such a change, the status summary for a
35 // healthy syncer will constantly display as "READY" and never provide any
36 // indication of a sync cycle being performed. See crbug.com/108100.
37
38 class AllStatus : public SyncEngineEventListener {
39 friend class ScopedStatusLock;
40 public:
41 AllStatus();
42 virtual ~AllStatus();
43
44 virtual void OnSyncEngineEvent(const SyncEngineEvent& event) OVERRIDE;
45
46 sync_api::SyncManager::Status status() const;
47
48 void SetNotificationsEnabled(bool notifications_enabled);
49
50 void IncrementNotifiableCommits();
51
52 void IncrementNotificationsReceived();
53
54 void SetEncryptedTypes(syncable::ModelTypeSet types);
55 void SetCryptographerReady(bool ready);
56 void SetCryptoHasPendingKeys(bool has_pending_keys);
57
58 void SetUniqueId(const std::string& guid);
59
60 protected:
61 // Examines syncer to calculate syncing and the unsynced count,
62 // and returns a Status with new values.
63 sync_api::SyncManager::Status CalcSyncing(const SyncEngineEvent& event) const;
64 sync_api::SyncManager::Status CreateBlankStatus() const;
65
66 sync_api::SyncManager::Status status_;
67
68 mutable base::Lock mutex_; // Protects all data members.
69 DISALLOW_COPY_AND_ASSIGN(AllStatus);
70 };
71
72 class ScopedStatusLock {
73 public:
74 explicit ScopedStatusLock(AllStatus* allstatus);
75 ~ScopedStatusLock();
76 protected:
77 AllStatus* allstatus_;
78 };
79
80 } // namespace browser_sync
81
82 #endif // SYNC_INTERNAL_API_ALL_STATUS_H_
OLDNEW
« no previous file with comments | « sync/engine/throttled_data_type_tracker_unittest.cc ('k') | sync/internal_api/all_status.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698