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

Unified Diff: chrome/browser/sync/glue/typed_url_model_associator.cc

Issue 7669057: Workaround/debug code for tracking down crbug.com/91473 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/typed_url_model_associator.cc
diff --git a/chrome/browser/sync/glue/typed_url_model_associator.cc b/chrome/browser/sync/glue/typed_url_model_associator.cc
index 08e47d43d27a5e7acdf438a4cd5f6dbabfae7a54..c2c1330a12911504a0068f60ce44bec4215efb35 100644
--- a/chrome/browser/sync/glue/typed_url_model_associator.cc
+++ b/chrome/browser/sync/glue/typed_url_model_associator.cc
@@ -201,8 +201,14 @@ bool TypedUrlModelAssociator::AssociateModels(SyncError* error) {
sync_child_id = sync_child_node.GetSuccessorId();
// Ignore old sync nodes that don't have any transition data stored with
- // them (will be deleted below).
- if (typed_url.visit_transitions_size() == 0) {
+ // them, or transition data that does not match the visit data (will be
+ // deleted below).
+ if (typed_url.visit_transitions_size() == 0 ||
+ typed_url.visit_transitions_size() != typed_url.visits_size()) {
+ // Generate a debug assertion to help track down http://crbug.com/91473,
+ // even though we gracefully handle this case by throwing away this
+ // node.
+ DCHECK_EQ(typed_url.visits_size(), typed_url.visit_transitions_size());
VLOG(1) << "Deleting obsolete sync node with no visit transition info.";
obsolete_nodes.push_back(sync_child_node.GetId());
continue;
@@ -434,7 +440,7 @@ int TypedUrlModelAssociator::MergeUrls(
DCHECK(!node.url().compare(url.url().spec()));
DCHECK(!node.url().compare(new_url->url().spec()));
DCHECK(visits->size());
- DCHECK_EQ(node.visits_size(), node.visit_transitions_size());
+ CHECK_EQ(node.visits_size(), node.visit_transitions_size());
// If we have an old-format node (before we added the visits and
// visit_transitions arrays to the protobuf), just overwrite
@@ -615,6 +621,7 @@ void TypedUrlModelAssociator::WriteToTypedUrlSpecifics(
DCHECK_EQ(skip_count, 0);
CHECK_GT(typed_url->visits_size(), 0);
CHECK_LE(typed_url->visits_size(), kMaxTypedUrlVisits);
+ CHECK_EQ(typed_url->visits_size(), typed_url->visit_transitions_size());
}
// static
@@ -659,7 +666,7 @@ void TypedUrlModelAssociator::DiffVisits(
void TypedUrlModelAssociator::UpdateURLRowFromTypedUrlSpecifics(
const sync_pb::TypedUrlSpecifics& typed_url, history::URLRow* new_url) {
DCHECK_GT(typed_url.visits_size(), 0);
- DCHECK_EQ(typed_url.visit_transitions_size(), typed_url.visits_size());
+ CHECK_EQ(typed_url.visit_transitions_size(), typed_url.visits_size());
new_url->set_title(UTF8ToUTF16(typed_url.title()));
new_url->set_hidden(typed_url.hidden());
new_url->set_last_visit(base::Time::FromInternalValue(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698