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

Unified Diff: components/sync/model_impl/shared_model_type_processor.h

Issue 2642493003: [Sync] Clean up SMTP startup flow. (Closed)
Patch Set: Address comments. Created 3 years, 11 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
« no previous file with comments | « no previous file | components/sync/model_impl/shared_model_type_processor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/model_impl/shared_model_type_processor.h
diff --git a/components/sync/model_impl/shared_model_type_processor.h b/components/sync/model_impl/shared_model_type_processor.h
index b0e7de776b37aed8af3892c8c7b9e8e6e27d57c1..68c8bcd80bb5b054dbb87d0fa3c222e6700312da 100644
--- a/components/sync/model_impl/shared_model_type_processor.h
+++ b/components/sync/model_impl/shared_model_type_processor.h
@@ -27,6 +27,7 @@
#include "components/sync/protocol/sync.pb.h"
namespace syncer {
+
class CommitQueue;
class ProcessorEntityTracker;
@@ -73,13 +74,8 @@ class SharedModelTypeProcessor : public ModelTypeProcessor,
friend class ModelTypeDebugInfo;
friend class SharedModelTypeProcessorTest;
- using EntityMap =
- std::map<std::string, std::unique_ptr<ProcessorEntityTracker>>;
- using UpdateMap = std::map<std::string, std::unique_ptr<UpdateResponseData>>;
-
- // Whether the preconditions to connect are met. Note: returns true if we have
- // already connected.
- bool ConnectPreconditionsMet() const;
+ // Returns true if the model is ready or encountered an error.
+ bool IsModelReadyOrError() const;
// If preconditions are met, inform sync that we are ready to connect.
void ConnectIfReady();
@@ -146,15 +142,16 @@ class SharedModelTypeProcessor : public ModelTypeProcessor,
// Stores the start callback in between OnSyncStarting() and ReadyToConnect().
StartCallback start_callback_;
- // A cache for any error that may occur during startup and should be passed
- // into the |start_callback_|.
- base::Optional<ModelError> start_error_;
+ // The first model error that occurred, if any. Stored to track model state
+ // and so it can be passed to sync if it happened prior to sync being ready.
+ base::Optional<ModelError> model_error_;
- // Indicates whether the metadata has finished loading.
- bool is_metadata_loaded_ = false;
+ // Whether we're waiting for the model to provide metadata.
+ bool waiting_for_metadata_ = true;
- // Indicates whether data for any initial pending commits has been loaded.
- bool is_initial_pending_data_loaded_ = false;
+ // Whether we're waiting for the model to provide initial commit data. Starts
+ // as false but will be set to true if we detect it's necessary to load data.
+ bool waiting_for_pending_data_ = false;
// Reference to the CommitQueue.
//
@@ -166,7 +163,7 @@ class SharedModelTypeProcessor : public ModelTypeProcessor,
// A map of client tag hash to sync entities known to this processor. This
// should contain entries and metadata for most everything, although the
// entities may not always contain model type data/specifics.
- EntityMap entities_;
+ std::map<std::string, std::unique_ptr<ProcessorEntityTracker>> entities_;
// The bridge wants to communicate entirely via storage keys that is free to
// define and can understand more easily. All of the sync machinery wants to
« no previous file with comments | « no previous file | components/sync/model_impl/shared_model_type_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698