diff options
author | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-17 02:23:18 +0000 |
---|---|---|
committer | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-17 02:23:18 +0000 |
commit | 2e79ac55e21eb17d9afd33e40d9c0fe70272d10a (patch) | |
tree | 0cdb485746bf906dea75cb55422ab579f19e9567 /sync/internal_api/write_node.cc | |
parent | 48c48280d9bba44ff14c3c665e9ef63c32c0e173 (diff) | |
download | chromium_src-2e79ac55e21eb17d9afd33e40d9c0fe70272d10a.zip chromium_src-2e79ac55e21eb17d9afd33e40d9c0fe70272d10a.tar.gz chromium_src-2e79ac55e21eb17d9afd33e40d9c0fe70272d10a.tar.bz2 |
Add additional error logging to investigate Autocomplete Sync failures.
BUG=122687
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10310113
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137617 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/write_node.cc')
-rw-r--r-- | sync/internal_api/write_node.cc | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/sync/internal_api/write_node.cc b/sync/internal_api/write_node.cc index ce20e31..68d3db7 100644 --- a/sync/internal_api/write_node.cc +++ b/sync/internal_api/write_node.cc @@ -364,13 +364,15 @@ bool WriteNode::InitByCreation(syncable::ModelType model_type, // we will attempt to undelete the node. // TODO(chron): Code datatype into hash tag. // TODO(chron): Is model type ever lost? -bool WriteNode::InitUniqueByCreation(syncable::ModelType model_type, - const BaseNode& parent, - const std::string& tag) { - DCHECK(!entry_) << "Init called twice"; +WriteNode::InitUniqueByCreationResult WriteNode::InitUniqueByCreation( + syncable::ModelType model_type, + const BaseNode& parent, + const std::string& tag) { + // This DCHECK will only fail if init is called twice. + DCHECK(!entry_); if (tag.empty()) { LOG(WARNING) << "InitUniqueByCreation failed due to empty tag."; - return false; + return INIT_FAILED_EMPTY_TAG; } const std::string hash = GenerateSyncableHash(model_type, tag); @@ -415,14 +417,13 @@ bool WriteNode::InitUniqueByCreation(syncable::ModelType model_type, existing_entry->Put(syncable::PARENT_ID, parent_id); entry_ = existing_entry.release(); } else { - return false; + return INIT_FAILED_ENTRY_ALREADY_EXISTS; } } else { entry_ = new syncable::MutableEntry(transaction_->GetWrappedWriteTrans(), syncable::CREATE, parent_id, dummy); - if (!entry_->good()) { - return false; - } + if (!entry_->good()) + return INIT_FAILED_COULD_NOT_CREATE_ENTRY; // Only set IS_DIR for new entries. Don't bitflip undeleted ones. entry_->Put(syncable::UNIQUE_CLIENT_TAG, hash); @@ -435,7 +436,11 @@ bool WriteNode::InitUniqueByCreation(syncable::ModelType model_type, PutModelType(model_type); // Now set the predecessor, which sets IS_UNSYNCED as necessary. - return PutPredecessor(NULL); + bool success = PutPredecessor(NULL); + if (!success) + return INIT_FAILED_SET_PREDECESSOR; + + return INIT_SUCCESS; } bool WriteNode::SetPosition(const BaseNode& new_parent, |