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

Unified Diff: components/sync/driver/glue/sync_backend_host_core.h

Issue 2388163002: [Sync] Move //components/sync to the syncer namespace, take 2. (Closed)
Patch Set: Rebase. Created 4 years, 2 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: components/sync/driver/glue/sync_backend_host_core.h
diff --git a/components/sync/driver/glue/sync_backend_host_core.h b/components/sync/driver/glue/sync_backend_host_core.h
index fd3563e39389394f41a269adb30ab3dcf7ef68db..ff914feee088558b10084d0905f604bad6e74d48 100644
--- a/components/sync/driver/glue/sync_backend_host_core.h
+++ b/components/sync/driver/glue/sync_backend_host_core.h
@@ -23,7 +23,7 @@
#include "components/sync/engine/cycle/type_debug_info_observer.h"
#include "url/gurl.h"
-namespace browser_sync {
+namespace syncer {
class SyncBackendHostImpl;
@@ -32,52 +32,46 @@ struct DoInitializeOptions {
DoInitializeOptions(
base::MessageLoop* sync_loop,
SyncBackendRegistrar* registrar,
- const std::vector<scoped_refptr<syncer::ModelSafeWorker>>& workers,
- const scoped_refptr<syncer::ExtensionsActivity>& extensions_activity,
- const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
+ const std::vector<scoped_refptr<ModelSafeWorker>>& workers,
+ const scoped_refptr<ExtensionsActivity>& extensions_activity,
+ const WeakHandle<JsEventHandler>& event_handler,
const GURL& service_url,
const std::string& sync_user_agent,
- std::unique_ptr<syncer::HttpPostProviderFactory> http_bridge_factory,
- const syncer::SyncCredentials& credentials,
+ std::unique_ptr<HttpPostProviderFactory> http_bridge_factory,
+ const SyncCredentials& credentials,
const std::string& invalidator_client_id,
- std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory,
+ std::unique_ptr<SyncManagerFactory> sync_manager_factory,
bool delete_sync_data_folder,
const std::string& restored_key_for_bootstrapping,
const std::string& restored_keystore_key_for_bootstrapping,
- std::unique_ptr<syncer::InternalComponentsFactory>
- internal_components_factory,
- const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>&
- unrecoverable_error_handler,
+ std::unique_ptr<InternalComponentsFactory> internal_components_factory,
+ const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler,
const base::Closure& report_unrecoverable_error_function,
- std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState>
- saved_nigori_state,
- const std::map<syncer::ModelType, int64_t>& invalidation_versions);
+ std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state,
+ const std::map<ModelType, int64_t>& invalidation_versions);
~DoInitializeOptions();
base::MessageLoop* sync_loop;
SyncBackendRegistrar* registrar;
- std::vector<scoped_refptr<syncer::ModelSafeWorker>> workers;
- scoped_refptr<syncer::ExtensionsActivity> extensions_activity;
- syncer::WeakHandle<syncer::JsEventHandler> event_handler;
+ std::vector<scoped_refptr<ModelSafeWorker>> workers;
+ scoped_refptr<ExtensionsActivity> extensions_activity;
+ WeakHandle<JsEventHandler> event_handler;
GURL service_url;
std::string sync_user_agent;
// Overridden by tests.
- std::unique_ptr<syncer::HttpPostProviderFactory> http_bridge_factory;
- syncer::SyncCredentials credentials;
+ std::unique_ptr<HttpPostProviderFactory> http_bridge_factory;
+ SyncCredentials credentials;
const std::string invalidator_client_id;
- std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory;
+ std::unique_ptr<SyncManagerFactory> sync_manager_factory;
std::string lsid;
bool delete_sync_data_folder;
std::string restored_key_for_bootstrapping;
std::string restored_keystore_key_for_bootstrapping;
- std::unique_ptr<syncer::InternalComponentsFactory>
- internal_components_factory;
- const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>
- unrecoverable_error_handler;
+ std::unique_ptr<InternalComponentsFactory> internal_components_factory;
+ const WeakHandle<UnrecoverableErrorHandler> unrecoverable_error_handler;
base::Closure report_unrecoverable_error_function;
- std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState>
- saved_nigori_state;
- const std::map<syncer::ModelType, int64_t> invalidation_versions;
+ std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state;
+ const std::map<ModelType, int64_t> invalidation_versions;
};
// Helper struct to handle currying params to
@@ -86,17 +80,17 @@ struct DoConfigureSyncerTypes {
DoConfigureSyncerTypes();
DoConfigureSyncerTypes(const DoConfigureSyncerTypes& other);
~DoConfigureSyncerTypes();
- syncer::ModelTypeSet to_download;
- syncer::ModelTypeSet to_purge;
- syncer::ModelTypeSet to_journal;
- syncer::ModelTypeSet to_unapply;
+ ModelTypeSet to_download;
+ ModelTypeSet to_purge;
+ ModelTypeSet to_journal;
+ ModelTypeSet to_unapply;
};
class SyncBackendHostCore
: public base::RefCountedThreadSafe<SyncBackendHostCore>,
- public syncer::SyncEncryptionHandler::Observer,
- public syncer::SyncManager::Observer,
- public syncer::TypeDebugInfoObserver {
+ public SyncEncryptionHandler::Observer,
+ public SyncManager::Observer,
+ public TypeDebugInfoObserver {
public:
SyncBackendHostCore(const std::string& name,
const base::FilePath& sync_data_folder_path,
@@ -106,49 +100,47 @@ class SyncBackendHostCore
// SyncManager::Observer implementation. The Core just acts like an air
// traffic controller here, forwarding incoming messages to appropriate
// landing threads.
- void OnSyncCycleCompleted(const syncer::SyncCycleSnapshot& snapshot) override;
+ void OnSyncCycleCompleted(const SyncCycleSnapshot& snapshot) override;
void OnInitializationComplete(
- const syncer::WeakHandle<syncer::JsBackend>& js_backend,
- const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
- debug_info_listener,
+ const WeakHandle<JsBackend>& js_backend,
+ const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener,
bool success,
- syncer::ModelTypeSet restored_types) override;
- void OnConnectionStatusChange(syncer::ConnectionStatus status) override;
- void OnActionableError(const syncer::SyncProtocolError& sync_error) override;
- void OnMigrationRequested(syncer::ModelTypeSet types) override;
- void OnProtocolEvent(const syncer::ProtocolEvent& event) override;
+ ModelTypeSet restored_types) override;
+ void OnConnectionStatusChange(ConnectionStatus status) override;
+ void OnActionableError(const SyncProtocolError& sync_error) override;
+ void OnMigrationRequested(ModelTypeSet types) override;
+ void OnProtocolEvent(const ProtocolEvent& event) override;
// SyncEncryptionHandler::Observer implementation.
void OnPassphraseRequired(
- syncer::PassphraseRequiredReason reason,
+ PassphraseRequiredReason reason,
const sync_pb::EncryptedData& pending_keys) override;
void OnPassphraseAccepted() override;
void OnBootstrapTokenUpdated(const std::string& bootstrap_token,
- syncer::BootstrapTokenType type) override;
- void OnEncryptedTypesChanged(syncer::ModelTypeSet encrypted_types,
+ BootstrapTokenType type) override;
+ void OnEncryptedTypesChanged(ModelTypeSet encrypted_types,
bool encrypt_everything) override;
void OnEncryptionComplete() override;
- void OnCryptographerStateChanged(
- syncer::Cryptographer* cryptographer) override;
- void OnPassphraseTypeChanged(syncer::PassphraseType type,
+ void OnCryptographerStateChanged(Cryptographer* cryptographer) override;
+ void OnPassphraseTypeChanged(PassphraseType type,
base::Time passphrase_time) override;
void OnLocalSetPassphraseEncryption(
- const syncer::SyncEncryptionHandler::NigoriState& nigori_state) override;
+ const SyncEncryptionHandler::NigoriState& nigori_state) override;
// TypeDebugInfoObserver implementation
- void OnCommitCountersUpdated(syncer::ModelType type,
- const syncer::CommitCounters& counters) override;
- void OnUpdateCountersUpdated(syncer::ModelType type,
- const syncer::UpdateCounters& counters) override;
- void OnStatusCountersUpdated(syncer::ModelType type,
- const syncer::StatusCounters& counters) override;
+ void OnCommitCountersUpdated(ModelType type,
+ const CommitCounters& counters) override;
+ void OnUpdateCountersUpdated(ModelType type,
+ const UpdateCounters& counters) override;
+ void OnStatusCountersUpdated(ModelType type,
+ const StatusCounters& counters) override;
// Forwards an invalidation state change to the sync manager.
- void DoOnInvalidatorStateChange(syncer::InvalidatorState state);
+ void DoOnInvalidatorStateChange(InvalidatorState state);
// Forwards an invalidation to the sync manager.
void DoOnIncomingInvalidation(
- const syncer::ObjectIdInvalidationMap& invalidation_map);
+ const ObjectIdInvalidationMap& invalidation_map);
// Note:
//
@@ -163,11 +155,11 @@ class SyncBackendHostCore
// Called to perform credential update on behalf of
// SyncBackendHost::UpdateCredentials.
- void DoUpdateCredentials(const syncer::SyncCredentials& credentials);
+ void DoUpdateCredentials(const SyncCredentials& credentials);
// Called to tell the syncapi to start syncing (generally after
// initialization and authentication).
- void DoStartSyncing(const syncer::ModelSafeRoutingInfo& routing_info,
+ void DoStartSyncing(const ModelSafeRoutingInfo& routing_info,
base::Time last_poll_time);
// Called to set the passphrase for encryption.
@@ -182,7 +174,7 @@ class SyncBackendHostCore
void DoEnableEncryptEverything();
// Ask the syncer to check for updates for the specified types.
- void DoRefreshTypes(syncer::ModelTypeSet types);
+ void DoRefreshTypes(ModelTypeSet types);
// Invoked if we failed to download the necessary control types at startup.
// Invokes SyncBackendHost::HandleControlTypesDownloadRetry.
@@ -198,28 +190,26 @@ class SyncBackendHostCore
// 2) Post DoShutdown() to sync loop to clean up backend state, save
// directory and destroy sync manager.
void ShutdownOnUIThread();
- void DoShutdown(syncer::ShutdownReason reason);
- void DoDestroySyncManager(syncer::ShutdownReason reason);
+ void DoShutdown(ShutdownReason reason);
+ void DoDestroySyncManager(ShutdownReason reason);
// Configuration methods that must execute on sync loop.
void DoConfigureSyncer(
- syncer::ConfigureReason reason,
+ ConfigureReason reason,
const DoConfigureSyncerTypes& config_types,
- const syncer::ModelSafeRoutingInfo routing_info,
- const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>&
- ready_task,
+ const ModelSafeRoutingInfo routing_info,
+ const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task,
const base::Closure& retry_callback);
void DoFinishConfigureDataTypes(
- syncer::ModelTypeSet types_to_config,
- const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>&
- ready_task);
+ ModelTypeSet types_to_config,
+ const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task);
void DoRetryConfiguration(const base::Closure& retry_callback);
// Set the base request context to use when making HTTP calls.
// This method will add a reference to the context to persist it
// on the IO thread. Must be removed from IO thread.
- syncer::SyncManager* sync_manager() { return sync_manager_.get(); }
+ SyncManager* sync_manager() { return sync_manager_.get(); }
void SendBufferedProtocolEventsAndEnableForwarding();
void DisableProtocolEventForwarding();
@@ -239,7 +229,7 @@ class SyncBackendHostCore
// We expose this member because it's required in the construction of the
// HttpBridgeFactory.
- syncer::CancelationSignal* GetRequestContextCancelationSignal() {
+ CancelationSignal* GetRequestContextCancelationSignal() {
return &release_request_context_signal_;
}
@@ -249,7 +239,7 @@ class SyncBackendHostCore
void SaveChanges();
void DoClearServerData(
- const syncer::SyncManager::ClearServerDataCallback& frontend_callback);
+ const SyncManager::ClearServerDataCallback& frontend_callback);
// Notify the syncer that the cookie jar has changed.
void DoOnCookieJarChanged(bool account_mismatch, bool empty_jar);
@@ -274,7 +264,7 @@ class SyncBackendHostCore
const base::FilePath sync_data_folder_path_;
// Our parent SyncBackendHost.
- syncer::WeakHandle<SyncBackendHostImpl> host_;
+ WeakHandle<SyncBackendHostImpl> host_;
// The loop where all the sync backend operations happen.
// Non-NULL only between calls to DoInitialize() and ~Core().
@@ -288,24 +278,24 @@ class SyncBackendHostCore
std::unique_ptr<base::RepeatingTimer> save_changes_timer_;
// Our encryptor, which uses Chrome's encryption functions.
- sync_driver::SystemEncryptor encryptor_;
+ SystemEncryptor encryptor_;
// The top-level syncapi entry point. Lives on the sync thread.
- std::unique_ptr<syncer::SyncManager> sync_manager_;
+ std::unique_ptr<SyncManager> sync_manager_;
// Temporary holder of sync manager's initialization results. Set by
// OnInitializeComplete, and consumed when we pass it via OnBackendInitialized
// in the final state of HandleInitializationSuccessOnFrontendLoop.
- syncer::WeakHandle<syncer::JsBackend> js_backend_;
- syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_;
+ WeakHandle<JsBackend> js_backend_;
+ WeakHandle<DataTypeDebugInfoListener> debug_info_listener_;
// These signals allow us to send requests to shut down the HttpBridgeFactory
// and ServerConnectionManager without having to wait for those classes to
// finish initializing first.
//
// See comments in SyncBackendHostCore::ShutdownOnUIThread() for more details.
- syncer::CancelationSignal release_request_context_signal_;
- syncer::CancelationSignal stop_syncing_signal_;
+ CancelationSignal release_request_context_signal_;
+ CancelationSignal stop_syncing_signal_;
// Matches the value of SyncPref's IsFirstSetupComplete() flag at init time.
// Should not be used for anything except for UMAs and logging.
@@ -321,13 +311,13 @@ class SyncBackendHostCore
// received invalidation version for each type.
// This allows dropping any invalidations with versions older than those
// most recently received for that data type.
- std::map<syncer::ModelType, int64_t> last_invalidation_versions_;
+ std::map<ModelType, int64_t> last_invalidation_versions_;
base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore);
};
-} // namespace browser_sync
+} // namespace syncer
#endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_
« no previous file with comments | « components/sync/driver/glue/sync_backend_host.cc ('k') | components/sync/driver/glue/sync_backend_host_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698