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

Unified Diff: sync/internal_api/public/non_blocking_type_processor.h

Issue 249843002: Introduce NonBlockingDataTypeController (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix one nit Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: sync/internal_api/public/non_blocking_type_processor.h
diff --git a/sync/internal_api/public/non_blocking_type_processor.h b/sync/internal_api/public/non_blocking_type_processor.h
index 0198c2763e33a887faabb32db525afb3e30492c4..3745088411c826729bbfad2993dc7666fc54b099 100644
--- a/sync/internal_api/public/non_blocking_type_processor.h
+++ b/sync/internal_api/public/non_blocking_type_processor.h
@@ -24,8 +24,20 @@ class SYNC_EXPORT_PRIVATE NonBlockingTypeProcessor : base::NonThreadSafe {
NonBlockingTypeProcessor(ModelType type);
virtual ~NonBlockingTypeProcessor();
+ // Returns true if this object believes that sync is preferred for this type.
+ //
+ // By "preferred", we mean that a policy decision has been made that this
+ // type should be synced. Most of the time this is controlled by a user
+ // clicking a checkbox on the settings page.
+ //
+ // The canonical preferred state is based on SyncPrefs on the UI thread. At
+ // best, this value is stale and may lag behind the one set on the UI thread.
+ // Before this type has registered with the UI thread, it's mostly just an
+ // informed guess.
+ bool IsPreferred() const;
+
// Returns true if the handshake with sync thread is complete.
- bool IsEnabled() const;
+ bool IsConnected() const;
// Returns the model type handled by this processor.
ModelType GetModelType() const;
@@ -33,10 +45,14 @@ class SYNC_EXPORT_PRIVATE NonBlockingTypeProcessor : base::NonThreadSafe {
// Starts the handshake with the sync thread.
void Enable(SyncCoreProxy* core_proxy);
- // Severs all ties to the sync thread.
+ // Severs all ties to the sync thread and may delete local sync state.
// Another call to Enable() can be used to re-establish this connection.
void Disable();
+ // Severs all ties to the sync thread.
+ // Another call to Enable() can be used to re-establish this connection.
+ void Disconnect();
+
// Callback used to process the handshake response.
void OnConnect(base::WeakPtr<NonBlockingTypeProcessorCore> core,
scoped_refptr<base::SequencedTaskRunner> sync_thread);
@@ -46,7 +62,14 @@ class SYNC_EXPORT_PRIVATE NonBlockingTypeProcessor : base::NonThreadSafe {
private:
ModelType type_;
sync_pb::DataTypeProgressMarker progress_marker_;
- bool enabled_;
+
+ // Whether or not sync is preferred for this type. This is a cached copy of
+ // the canonical copy information on the UI thread.
+ bool is_preferred_;
+
+ // Whether or not this object has completed its initial handshake with the
+ // SyncCoreProxy.
+ bool is_connected_;
base::WeakPtr<NonBlockingTypeProcessorCore> core_;
scoped_refptr<base::SequencedTaskRunner> sync_thread_;
« no previous file with comments | « sync/internal_api/non_blocking_type_processor.cc ('k') | sync/internal_api/sync_core_proxy_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698