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

Unified Diff: sync/engine/non_blocking_type_processor.cc

Issue 299963002: sync: Implement NonBlockingTypeProcessorCore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unbreak some tests Created 6 years, 6 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/engine/non_blocking_type_processor.cc
diff --git a/sync/engine/non_blocking_type_processor.cc b/sync/engine/non_blocking_type_processor.cc
index 0aaead452cf5f34febe2c9b2b1a536fa8e6b3f0e..c1982b3ec9f002cd2050cab14237d4e92aab39f3 100644
--- a/sync/engine/non_blocking_type_processor.cc
+++ b/sync/engine/non_blocking_type_processor.cc
@@ -51,7 +51,6 @@ void NonBlockingTypeProcessor::Enable(
// TODO(rlarocque): At some point, this should be loaded from storage.
data_type_state_.progress_marker.set_data_type_id(
GetSpecificsFieldNumberFromModelType(type_));
- data_type_state_.next_client_id = 0;
sync_core_proxy_ = sync_core_proxy.Pass();
sync_core_proxy_->ConnectTypeToCore(GetModelType(),
@@ -142,6 +141,10 @@ void NonBlockingTypeProcessor::FlushPendingCommitRequests() {
if (!IsConnected())
return;
+ // Don't send anything if the type is not ready to handle commits.
+ if (!data_type_state_.initial_sync_done)
+ return;
+
// TODO(rlarocque): Do something smarter than iterate here.
for (EntityMap::iterator it = entities_.begin(); it != entities_.end();
++it) {
@@ -184,6 +187,9 @@ void NonBlockingTypeProcessor::OnCommitCompletion(
void NonBlockingTypeProcessor::OnUpdateReceived(
const DataTypeState& data_type_state,
const UpdateResponseDataList& response_list) {
+ bool initial_sync_just_finished =
+ !data_type_state_.initial_sync_done && data_type_state.initial_sync_done;
+
data_type_state_ = data_type_state;
for (UpdateResponseDataList::const_iterator list_it = response_list.begin();
@@ -215,6 +221,9 @@ void NonBlockingTypeProcessor::OnUpdateReceived(
}
}
+ if (initial_sync_just_finished)
+ FlushPendingCommitRequests();
+
// TODO: Inform the model of the new or updated data.
}
« no previous file with comments | « sync/engine/non_blocking_type_commit_contribution.cc ('k') | sync/engine/non_blocking_type_processor_core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698