OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <limits> | 10 #include <limits> |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 // Sanity check on positions. We risk strange and rare crashes if our | 169 // Sanity check on positions. We risk strange and rare crashes if our |
170 // assumptions about unique position values are broken. | 170 // assumptions about unique position values are broken. |
171 if (kernel->ShouldMaintainPosition() && | 171 if (kernel->ShouldMaintainPosition() && |
172 !kernel->ref(UNIQUE_POSITION).IsValid()) { | 172 !kernel->ref(UNIQUE_POSITION).IsValid()) { |
173 DVLOG(1) << "Unpacked invalid position on an entity that should have a " | 173 DVLOG(1) << "Unpacked invalid position on an entity that should have a " |
174 << "valid position. Assuming the DB is corrupt."; | 174 << "valid position. Assuming the DB is corrupt."; |
175 return scoped_ptr<EntryKernel>(); | 175 return scoped_ptr<EntryKernel>(); |
176 } | 176 } |
177 | 177 |
178 return kernel.Pass(); | 178 return kernel; |
179 } | 179 } |
180 | 180 |
181 namespace { | 181 namespace { |
182 | 182 |
183 // This just has to be big enough to hold an UPDATE or INSERT statement that | 183 // This just has to be big enough to hold an UPDATE or INSERT statement that |
184 // modifies all the columns in the entry table. | 184 // modifies all the columns in the entry table. |
185 static const string::size_type kUpdateStatementBufferSize = 2048; | 185 static const string::size_type kUpdateStatementBufferSize = 2048; |
186 | 186 |
187 void OnSqliteError(const base::Closure& catastrophic_error_handler, | 187 void OnSqliteError(const base::Closure& catastrophic_error_handler, |
188 int err, | 188 int err, |
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 DCHECK(CalledOnValidThread()); | 1746 DCHECK(CalledOnValidThread()); |
1747 DCHECK(!catastrophic_error_handler.is_null()); | 1747 DCHECK(!catastrophic_error_handler.is_null()); |
1748 catastrophic_error_handler_ = catastrophic_error_handler; | 1748 catastrophic_error_handler_ = catastrophic_error_handler; |
1749 sql::Connection::ErrorCallback error_callback = | 1749 sql::Connection::ErrorCallback error_callback = |
1750 base::Bind(&OnSqliteError, catastrophic_error_handler_); | 1750 base::Bind(&OnSqliteError, catastrophic_error_handler_); |
1751 db_->set_error_callback(error_callback); | 1751 db_->set_error_callback(error_callback); |
1752 } | 1752 } |
1753 | 1753 |
1754 } // namespace syncable | 1754 } // namespace syncable |
1755 } // namespace syncer | 1755 } // namespace syncer |
OLD | NEW |