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

Side by Side Diff: sync/syncable/directory_backing_store.cc

Issue 283143002: sync: Improve handling of bad UniquePos (retry) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/syncable/directory.cc ('k') | sync/syncable/directory_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/syncable/directory_backing_store.h" 5 #include "sync/syncable/directory_backing_store.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return scoped_ptr<EntryKernel>(); 116 return scoped_ptr<EntryKernel>();
117 } 117 }
118 118
119 kernel->mutable_ref(static_cast<UniquePositionField>(i)) = 119 kernel->mutable_ref(static_cast<UniquePositionField>(i)) =
120 UniquePosition::FromProto(proto); 120 UniquePosition::FromProto(proto);
121 } 121 }
122 for (; i < ATTACHMENT_METADATA_FIELDS_END; ++i) { 122 for (; i < ATTACHMENT_METADATA_FIELDS_END; ++i) {
123 kernel->mutable_ref(static_cast<AttachmentMetadataField>(i)).ParseFromArray( 123 kernel->mutable_ref(static_cast<AttachmentMetadataField>(i)).ParseFromArray(
124 statement->ColumnBlob(i), statement->ColumnByteLength(i)); 124 statement->ColumnBlob(i), statement->ColumnByteLength(i));
125 } 125 }
126
127 // Sanity check on positions. We risk strange and rare crashes if our
128 // assumptions about unique position values are broken.
129 if (kernel->ShouldMaintainPosition() &&
130 !kernel->ref(UNIQUE_POSITION).IsValid()) {
131 DVLOG(1) << "Unpacked invalid position on an entity that should have a "
132 << "valid position. Assuming the DB is corrupt.";
133 return scoped_ptr<EntryKernel>();
134 }
135
126 return kernel.Pass(); 136 return kernel.Pass();
127 } 137 }
128 138
129 namespace { 139 namespace {
130 140
131 string ComposeCreateTableColumnSpecs() { 141 string ComposeCreateTableColumnSpecs() {
132 const ColumnSpec* begin = g_metas_columns; 142 const ColumnSpec* begin = g_metas_columns;
133 const ColumnSpec* end = g_metas_columns + arraysize(g_metas_columns); 143 const ColumnSpec* end = g_metas_columns + arraysize(g_metas_columns);
134 string query; 144 string query;
135 query.reserve(kUpdateStatementBufferSize); 145 query.reserve(kUpdateStatementBufferSize);
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 } 1568 }
1559 query.append(" ) "); 1569 query.append(" ) ");
1560 values.append(" )"); 1570 values.append(" )");
1561 query.append(values); 1571 query.append(values);
1562 save_statement->Assign(db_->GetUniqueStatement( 1572 save_statement->Assign(db_->GetUniqueStatement(
1563 base::StringPrintf(query.c_str(), "metas").c_str())); 1573 base::StringPrintf(query.c_str(), "metas").c_str()));
1564 } 1574 }
1565 1575
1566 } // namespace syncable 1576 } // namespace syncable
1567 } // namespace syncer 1577 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/directory.cc ('k') | sync/syncable/directory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698