Chromium Code Reviews| Index: components/sync/driver/glue/sync_backend_host_impl.h |
| diff --git a/components/sync/driver/glue/sync_backend_host_impl.h b/components/sync/driver/glue/sync_backend_host_impl.h |
| index 59fa562ebd32f9d19fdab0f47c770801d81c08a2..31bcc17d1de1ae64b07fb814fef6b590e4ffa8ff 100644 |
| --- a/components/sync/driver/glue/sync_backend_host_impl.h |
| +++ b/components/sync/driver/glue/sync_backend_host_impl.h |
| @@ -17,17 +17,16 @@ |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/weak_ptr.h" |
| -#include "base/single_thread_task_runner.h" |
| -#include "base/threading/thread.h" |
| +#include "base/threading/thread_checker.h" |
| #include "components/invalidation/public/invalidation_handler.h" |
| #include "components/sync/base/extensions_activity.h" |
| #include "components/sync/base/model_type.h" |
| #include "components/sync/base/weak_handle.h" |
| -#include "components/sync/driver/backend_data_type_configurer.h" |
| -#include "components/sync/driver/glue/sync_backend_host.h" |
| #include "components/sync/engine/configure_reason.h" |
| #include "components/sync/engine/cycle/sync_cycle_snapshot.h" |
| #include "components/sync/engine/cycle/type_debug_info_observer.h" |
| +#include "components/sync/engine/model_type_configurer.h" |
| +#include "components/sync/engine/sync_engine.h" |
| #include "components/sync/engine/sync_manager.h" |
| #include "components/sync/protocol/encryption.pb.h" |
| #include "components/sync/protocol/sync_protocol_error.h" |
| @@ -49,16 +48,16 @@ class SyncPrefs; |
| class UnrecoverableErrorHandler; |
| struct DoInitializeOptions; |
| -// The only real implementation of the SyncBackendHost. See that interface's |
| +// The only real implementation of the SyncEngine. See that interface's |
|
skym
2016/12/02 20:54:54
You don't normally leave in double space sentence
maxbogue
2016/12/02 23:59:27
You know me too well.
|
| // definition for documentation of public methods. |
| -class SyncBackendHostImpl : public SyncBackendHost, public InvalidationHandler { |
| +class SyncBackendHostImpl : public SyncEngine, public InvalidationHandler { |
| public: |
| typedef SyncStatus Status; |
| - // Create a SyncBackendHost with a reference to the |frontend| that |
| - // it serves and communicates to via the SyncFrontend interface (on |
| - // the same thread it used to call the constructor). Must outlive |
| - // |sync_prefs|. |
| + // Create a SyncEngine with a reference to the |host| that it serves and |
|
skym
2016/12/02 20:54:54
Where's the reference to the host in this ctor? Is
maxbogue
2016/12/02 23:59:27
Removing the whole comment.
|
| + // communicates to via the SyncEngineHost interface (on the same thread it |
| + // used to |
| + // call the constructor). Must outlive |sync_prefs|. |
| SyncBackendHostImpl( |
| const std::string& name, |
| SyncClient* sync_client, |
| @@ -67,9 +66,9 @@ class SyncBackendHostImpl : public SyncBackendHost, public InvalidationHandler { |
| const base::FilePath& sync_folder); |
| ~SyncBackendHostImpl() override; |
| - // SyncBackendHost implementation. |
| + // SyncEngine implementation. |
| void Initialize( |
|
skym
2016/12/02 20:54:54
I'm still a bit confused why exactly the second st
maxbogue
2016/12/02 23:59:27
I dunno about before but now it's important becaus
|
| - SyncFrontend* frontend, |
| + SyncEngineHost* host, |
| scoped_refptr<base::SingleThreadTaskRunner> sync_task_runner, |
| const WeakHandle<JsEventHandler>& event_handler, |
| const GURL& service_url, |
| @@ -170,9 +169,9 @@ class SyncBackendHostImpl : public SyncBackendHost, public InvalidationHandler { |
| std::unique_ptr<ModelTypeConnector> model_type_connector, |
| const std::string& cache_guid); |
| - // Forwards a ProtocolEvent to the frontend. Will not be called unless a |
| - // call to SetForwardProtocolEvents() explicitly requested that we start |
| - // forwarding these events. |
| + // Forwards a ProtocolEvent to the host. Will not be called unless a call to |
| + // SetForwardProtocolEvents() explicitly requested that we start forwarding |
| + // these events. |
| void HandleProtocolEventOnFrontendLoop(std::unique_ptr<ProtocolEvent> event); |
| // Forwards a directory commit counter update to the frontend loop. Will not |
| @@ -201,7 +200,7 @@ class SyncBackendHostImpl : public SyncBackendHost, public InvalidationHandler { |
| void UpdateInvalidationVersions( |
| const std::map<ModelType, int64_t>& invalidation_versions); |
| - SyncFrontend* frontend() { return frontend_; } |
| + SyncEngineHost* host() { return host_; } |
| private: |
| friend class SyncBackendHostCore; |
| @@ -304,14 +303,14 @@ class SyncBackendHostImpl : public SyncBackendHost, public InvalidationHandler { |
| // object is owned because in production code it is a proxy object. |
| std::unique_ptr<ModelTypeConnector> model_type_connector_; |
| - bool initialized_; |
| + bool initialized_ = false; |
| const base::WeakPtr<SyncPrefs> sync_prefs_; |
| std::unique_ptr<SyncBackendRegistrar> registrar_; |
| - // The frontend which we serve (and are owned by). |
| - SyncFrontend* frontend_; |
| + // The host which we serve (and are owned by). |
|
skym
2016/12/02 20:54:54
Might be a good place to comment about the lifecyc
maxbogue
2016/12/02 23:59:27
Done.
|
| + SyncEngineHost* host_ = nullptr; |
| // We cache the cryptographer's pending keys whenever NotifyPassphraseRequired |
| // is called. This way, before the UI calls SetDecryptionPassphrase on the |
| @@ -327,7 +326,7 @@ class SyncBackendHostImpl : public SyncBackendHost, public InvalidationHandler { |
| // in the nigori node. Updated whenever a new nigori node arrives or the user |
| // manually changes their passphrase state. Cached so we can synchronously |
| // check it from the UI thread. |
| - PassphraseType cached_passphrase_type_; |
| + PassphraseType cached_passphrase_type_ = PassphraseType::IMPLICIT_PASSPHRASE; |
| // If an explicit passphrase is in use, the time at which the passphrase was |
| // first set (if available). |
| @@ -337,7 +336,7 @@ class SyncBackendHostImpl : public SyncBackendHost, public InvalidationHandler { |
| SyncCycleSnapshot last_snapshot_; |
| invalidation::InvalidationService* invalidator_; |
| - bool invalidation_handler_registered_; |
| + bool invalidation_handler_registered_ = false; |
| // Checks that we're on the same thread this was constructed on (UI thread). |
| base::ThreadChecker thread_checker_; |