OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "sql/connection.h" | 5 #include "sql/connection.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 basic_error == SQLITE_NOTADB || | 253 basic_error == SQLITE_NOTADB || |
254 basic_error == SQLITE_CORRUPT; | 254 basic_error == SQLITE_CORRUPT; |
255 } | 255 } |
256 | 256 |
257 void Connection::ReportDiagnosticInfo(int extended_error, Statement* stmt) { | 257 void Connection::ReportDiagnosticInfo(int extended_error, Statement* stmt) { |
258 AssertIOAllowed(); | 258 AssertIOAllowed(); |
259 | 259 |
260 std::string debug_info; | 260 std::string debug_info; |
261 const int error = (extended_error & 0xFF); | 261 const int error = (extended_error & 0xFF); |
262 if (error == SQLITE_CORRUPT) { | 262 if (error == SQLITE_CORRUPT) { |
| 263 // CollectCorruptionInfo() is implemented in terms of sql::Connection, |
| 264 // prevent reentrant calls to the error callback. |
| 265 // TODO(shess): Rewrite IntegrityCheckHelper() in terms of raw SQLite. |
| 266 ErrorCallback original_callback = std::move(error_callback_); |
| 267 reset_error_callback(); |
| 268 |
263 debug_info = CollectCorruptionInfo(); | 269 debug_info = CollectCorruptionInfo(); |
| 270 |
| 271 error_callback_ = std::move(original_callback); |
264 } else { | 272 } else { |
265 debug_info = CollectErrorInfo(extended_error, stmt); | 273 debug_info = CollectErrorInfo(extended_error, stmt); |
266 } | 274 } |
267 | 275 |
268 if (!debug_info.empty() && RegisterIntentToUpload()) { | 276 if (!debug_info.empty() && RegisterIntentToUpload()) { |
269 char debug_buf[2000]; | 277 char debug_buf[2000]; |
270 base::strlcpy(debug_buf, debug_info.c_str(), arraysize(debug_buf)); | 278 base::strlcpy(debug_buf, debug_info.c_str(), arraysize(debug_buf)); |
271 base::debug::Alias(&debug_buf); | 279 base::debug::Alias(&debug_buf); |
272 | 280 |
273 base::debug::DumpWithoutCrashing(); | 281 base::debug::DumpWithoutCrashing(); |
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 ignore_result(Execute(kNoWritableSchema)); | 1967 ignore_result(Execute(kNoWritableSchema)); |
1960 | 1968 |
1961 return ret; | 1969 return ret; |
1962 } | 1970 } |
1963 | 1971 |
1964 base::TimeTicks TimeSource::Now() { | 1972 base::TimeTicks TimeSource::Now() { |
1965 return base::TimeTicks::Now(); | 1973 return base::TimeTicks::Now(); |
1966 } | 1974 } |
1967 | 1975 |
1968 } // namespace sql | 1976 } // namespace sql |
OLD | NEW |