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