Chromium Code Reviews| Index: components/sync_driver/non_blocking_data_type_controller.h |
| diff --git a/components/sync_driver/non_blocking_data_type_controller.h b/components/sync_driver/non_blocking_data_type_controller.h |
| index 4a1c66c1ac3fe3a68e593e278ee52af471e85dfe..68eeecd6d7842bbc48457c8c3d9d72f53eb630bf 100644 |
| --- a/components/sync_driver/non_blocking_data_type_controller.h |
| +++ b/components/sync_driver/non_blocking_data_type_controller.h |
| @@ -9,10 +9,10 @@ |
| #include "base/memory/weak_ptr.h" |
| #include "base/sequenced_task_runner.h" |
| #include "sync/internal_api/public/base/model_type.h" |
| -#include "sync/internal_api/public/sync_core_proxy.h" |
| +#include "sync/internal_api/public/sync_context_proxy.h" |
| namespace syncer { |
| -class NonBlockingTypeProcessor; |
| +class ModelTypeSyncProxy; |
| } |
| namespace browser_sync { |
| @@ -21,32 +21,33 @@ namespace browser_sync { |
| // components. |
| // |
| // There are three main parts to this controller: |
| -// - The SyncCoreProxy, represening the sync thread. |
| -// - The NonBlockingTypeProcessor, representing the model type thread. |
| +// - The SyncContextProxy, represening the sync thread. |
| +// - The ModelTypeSyncProxy, representing the model type thread. |
| // - The user-set state for this type (prefs), which lives on the UI thread. |
| // |
| -// The NonBlockingSyncTypeProcessor can exist in three different states. Those |
| +// The ModelTypeSyncProxy can exist in three different states. Those |
| // states are: |
| // - Enabled: Changes are being synced. |
| // - Disconnected: Changes would be synced, but there is no connection between |
| // the sync thread and the model thread. |
| -// - Disabled: Syncing is intentionally disabled. The processor may clear any |
| +// - Disabled: Syncing is intentionally disabled. The type proxy may clear any |
| // of its local state associated with sync when this happens, since |
| // this is expected to last a while. |
| // |
| -// This controller is responsible for transitioning the processor into and out |
| +// This controller is responsible for transitioning the type proxy into and out |
| // of these states. It does this by posting tasks to the model type thread. |
| // |
| -// The processor is enabled when the user has indicated a desire to sync this |
| -// type, and the NonBlockingTypeProcessor and SyncCoreProxy are available. |
| +// The type proxy is enabled when the user has indicated a desire to sync this |
| +// type, and the ModelTypeSyncProxy and SyncContextProxy are available. |
| // |
| -// The processor is disconnected during initialization, or when either the |
| -// NonBlockingDataTypeController or SyncCoreProxy have not yet registered. It |
| -// can also be disconnected later on if the sync backend becomes unavailable. |
| +// The type proxy is disconnected during initialization, or when either the |
| +// NonBlockingDataTypeController or SyncContextProxy have not yet registered. |
| +// It can also be disconnected later on if the sync backend becomes |
| +// unavailable. |
| // |
| -// The processor is disabled if the user has disabled sync for this type. The |
| -// signal indicating this state will be sent to the processor when the pref is |
| -// first changed, or when the processor first connects to the controller. |
| +// The type proxy is disabled if the user has disabled sync for this type. The |
| +// signal indicating this state will be sent to the type proxy when the pref is |
| +// first changed, or when the type proxy first connects to the controller. |
| // |
| // This class is structured using some state machine patterns. It's a bit |
| // awkward at times, but this seems to be the clearest way to express the |
| @@ -56,21 +57,22 @@ class NonBlockingDataTypeController { |
| NonBlockingDataTypeController(syncer::ModelType type, bool is_preferred); |
| ~NonBlockingDataTypeController(); |
| - // Connects the NonBlockingTypeProcessor to this controller. |
| + // Connects the ModelTypeSyncProxy to this controller. |
| // |
| // There is no "undo" for this operation. The NonBlockingDataTypeController |
| - // will only ever deal with a single processor. |
| - void InitializeProcessor( |
| + // will only ever deal with a single type proxy. |
| + void InitializeTypeSyncProxy( |
|
stanisc
2014/06/24 21:59:01
Function names don't have to repeat Proxy or SyncP
rlarocque
2014/06/24 23:08:32
Good point. I've implemented the renames you ment
|
| scoped_refptr<base::SequencedTaskRunner> task_runner, |
| - base::WeakPtr<syncer::NonBlockingTypeProcessor> processor); |
| + base::WeakPtr<syncer::ModelTypeSyncProxyImpl> type_sync_proxy); |
|
Nicolas Zea
2014/06/24 22:42:48
nit: const ref here too
rlarocque
2014/06/24 23:08:32
Done.
|
| - // Initialize the connection to the SyncCoreProxy. |
| + // Initialize the connection to the SyncContextProxy. |
| // |
| - // This process may be reversed with ClearSyncCoreProxy(). |
| - void InitializeSyncCoreProxy(scoped_ptr<syncer::SyncCoreProxy> proxy); |
| + // This process may be reversed with ClearSyncContextProxy(). |
| + void InitializeSyncContextProxy( |
| + scoped_ptr<syncer::SyncContextProxy> sync_context_proxy); |
| - // Disconnect from the current SyncCoreProxy. |
| - void ClearSyncCoreProxy(); |
| + // Disconnect from the current SyncContextProxy. |
| + void ClearSyncContextProxy(); |
| // Sets the current preferred state. |
| // |
| @@ -80,53 +82,54 @@ class NonBlockingDataTypeController { |
| void SetIsPreferred(bool is_preferred); |
| private: |
| - enum TypeProcessorState { ENABLED, DISABLED, DISCONNECTED }; |
| + enum TypeSyncProxyState { ENABLED, DISABLED, DISCONNECTED }; |
| // Figures out which signals need to be sent then send then sends them. |
| void UpdateState(); |
| - // Sends an enable signal to the NonBlockingTypeProcessor. |
| + // Sends an enable signal to the ModelTypeSyncProxyImpl. |
| void SendEnableSignal(); |
| - // Sends a disable signal to the NonBlockingTypeProcessor. |
| + // Sends a disable signal to the ModelTypeSyncProxyImpl. |
| void SendDisableSignal(); |
| - // Sends a disconnect signal to the NonBlockingTypeProcessor. |
| + // Sends a disconnect signal to the ModelTypeSyncProxyImpl. |
| void SendDisconnectSignal(); |
| // Returns true if this type should be synced. |
| bool IsPreferred() const; |
| - // Returns true if this object has access to the NonBlockingTypeProcessor. |
| - bool IsTypeProcessorConnected() const; |
| + // Returns true if this object has access to the ModelTypeSyncProxyImpl. |
| + bool IsSyncProxyConnected() const; |
| - // Returns true if this object has access to the SyncCoreProxy. |
| + // Returns true if this object has access to the SyncContextProxy. |
| bool IsSyncBackendConnected() const; |
| - // Returns the state that the processor *should* be in. |
| - TypeProcessorState GetDesiredState() const; |
| + // Returns the state that the type sync proxy should be in. |
| + TypeSyncProxyState GetDesiredState() const; |
| // The ModelType we're controlling. Kept mainly for debugging. |
| const syncer::ModelType type_; |
| - // Returns the state that the processor is actually in, from this class' |
| - // point of view. |
| + // Returns the state that the type sync proxy is actually in, from this |
| + // class' point of view. |
| // |
| // This state is inferred based on the most recently sent signals, and is |
| - // intended to represent the state the processor will be in by the time any |
| + // intended to represent the state the sync proxy will be in by the time any |
| // tasks we post to it now will be run. Due to threading / queueing effects, |
| // this may or may not be the actual state at this point in time. |
| - TypeProcessorState current_state_; |
| + TypeSyncProxyState current_state_; |
| // Whether or not the user wants to sync this type. |
| bool is_preferred_; |
| - // The NonBlockingTypeProcessor and its associated thread. May be NULL. |
| + // The ModelTypeSyncProxyImpl and its associated thread. May be NULL. |
| scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| - base::WeakPtr<syncer::NonBlockingTypeProcessor> processor_; |
| + base::WeakPtr<syncer::ModelTypeSyncProxyImpl> type_sync_proxy_; |
| - // The SyncCoreProxy that connects to the current sync backend. May be NULL. |
| - scoped_ptr<syncer::SyncCoreProxy> proxy_; |
| + // The SyncContextProxy that connects to the current sync backend. May be |
| + // NULL. |
| + scoped_ptr<syncer::SyncContextProxy> sync_context_proxy_; |
|
stanisc
2014/06/24 21:59:01
I wonder if sync_context_proxy_ and type_sync_prox
rlarocque
2014/06/24 23:08:32
I see your point. I agree with you in the case of
|
| DISALLOW_COPY_AND_ASSIGN(NonBlockingDataTypeController); |
| }; |