Commit a2f928a4 authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Add DVLOG traces to ModelTypeController

They are motivated by an ongoing investigation for test
flakiness on iOS, with the suspicion that some of the codepaths
(namely, where calls to OnSyncStopping() could be dropped) can
cause issues (e.g. sync metadata being leaked).

Bug: 854446
Change-Id: I6fe7da40c36d00e01afa176334f59f9dc66a74e1
Reviewed-on: https://chromium-review.googlesource.com/1108200Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569225}
parent 2944cf12
...@@ -117,6 +117,7 @@ void ModelTypeController::LoadModels( ...@@ -117,6 +117,7 @@ void ModelTypeController::LoadModels(
return; return;
} }
DVLOG(1) << "Sync starting for " << ModelTypeToString(type());
state_ = MODEL_STARTING; state_ = MODEL_STARTING;
// Callback that posts back to the UI thread. // Callback that posts back to the UI thread.
...@@ -154,6 +155,10 @@ void ModelTypeController::LoadModelsDone(ConfigureResult result, ...@@ -154,6 +155,10 @@ void ModelTypeController::LoadModelsDone(ConfigureResult result,
if (state_ == NOT_RUNNING) { if (state_ == NOT_RUNNING) {
// The callback arrived on the UI thread after the type has been already // The callback arrived on the UI thread after the type has been already
// stopped. // stopped.
DVLOG(1) << "Sync start completion received late for "
<< ModelTypeToString(type()) << ", it has been stopped meanwhile";
// TODO(mastiz): Call to Stop() here, but think through if that's enough,
// because perhaps the datatype was reenabled.
RecordStartFailure(ABORTED); RecordStartFailure(ABORTED);
return; return;
} }
...@@ -161,6 +166,7 @@ void ModelTypeController::LoadModelsDone(ConfigureResult result, ...@@ -161,6 +166,7 @@ void ModelTypeController::LoadModelsDone(ConfigureResult result,
if (IsSuccessfulResult(result)) { if (IsSuccessfulResult(result)) {
DCHECK_EQ(MODEL_STARTING, state_); DCHECK_EQ(MODEL_STARTING, state_);
state_ = MODEL_LOADED; state_ = MODEL_LOADED;
DVLOG(1) << "Sync start completed for " << ModelTypeToString(type());
} else { } else {
RecordStartFailure(result); RecordStartFailure(result);
} }
...@@ -206,6 +212,7 @@ void ModelTypeController::StartAssociating( ...@@ -206,6 +212,7 @@ void ModelTypeController::StartAssociating(
DCHECK_EQ(MODEL_LOADED, state_); DCHECK_EQ(MODEL_LOADED, state_);
state_ = RUNNING; state_ = RUNNING;
DVLOG(1) << "Sync running for " << ModelTypeToString(type());
// There is no association, just call back promptly. // There is no association, just call back promptly.
SyncMergeResult merge_result(type()); SyncMergeResult merge_result(type());
...@@ -240,8 +247,15 @@ void ModelTypeController::Stop(SyncStopMetadataFate metadata_fate) { ...@@ -240,8 +247,15 @@ void ModelTypeController::Stop(SyncStopMetadataFate metadata_fate) {
// Only call StopSync if the delegate is ready to handle it (controller is // Only call StopSync if the delegate is ready to handle it (controller is
// in loaded state). // in loaded state).
if (state() == MODEL_LOADED || state() == RUNNING) { if (state() == MODEL_LOADED || state() == RUNNING) {
DVLOG(1) << "Stopping sync for " << ModelTypeToString(type());
PostModelTask(FROM_HERE, PostModelTask(FROM_HERE,
base::BindOnce(&StopSyncHelperOnModelThread, metadata_fate)); base::BindOnce(&StopSyncHelperOnModelThread, metadata_fate));
} else {
DCHECK_EQ(MODEL_STARTING, state_);
DVLOG(1) << "Shortcutting stop for " << ModelTypeToString(type())
<< " because it's still starting";
// TODO(mastiz): Enter STOPPING state here and/or queue pending stops,
// together with |metadata_fate|.
} }
state_ = NOT_RUNNING; state_ = NOT_RUNNING;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment