OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/recovery.h" | 5 #include "sql/recovery.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
10 #include "sql/connection.h" | 10 #include "sql/connection.h" |
11 #include "third_party/sqlite/sqlite3.h" | 11 #include "third_party/sqlite/sqlite3.h" |
12 | 12 |
13 namespace sql { | 13 namespace sql { |
14 | 14 |
15 // static | 15 // static |
| 16 bool Recovery::FullRecoverySupported() { |
| 17 // TODO(shess): See comment in Init(). |
| 18 #if defined(USE_SYSTEM_SQLITE) |
| 19 return false; |
| 20 #else |
| 21 return true; |
| 22 #endif |
| 23 } |
| 24 |
| 25 // static |
16 scoped_ptr<Recovery> Recovery::Begin( | 26 scoped_ptr<Recovery> Recovery::Begin( |
17 Connection* connection, | 27 Connection* connection, |
18 const base::FilePath& db_path) { | 28 const base::FilePath& db_path) { |
19 scoped_ptr<Recovery> r(new Recovery(connection)); | 29 scoped_ptr<Recovery> r(new Recovery(connection)); |
20 if (!r->Init(db_path)) { | 30 if (!r->Init(db_path)) { |
21 // TODO(shess): Should Init() failure result in Raze()? | 31 // TODO(shess): Should Init() failure result in Raze()? |
22 r->Shutdown(POISON); | 32 r->Shutdown(POISON); |
23 return scoped_ptr<Recovery>(); | 33 return scoped_ptr<Recovery>(); |
24 } | 34 } |
25 | 35 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 recover_db_.Close(); | 227 recover_db_.Close(); |
218 if (raze == RAZE_AND_POISON) { | 228 if (raze == RAZE_AND_POISON) { |
219 db_->RazeAndClose(); | 229 db_->RazeAndClose(); |
220 } else if (raze == POISON) { | 230 } else if (raze == POISON) { |
221 db_->Poison(); | 231 db_->Poison(); |
222 } | 232 } |
223 db_ = NULL; | 233 db_ = NULL; |
224 } | 234 } |
225 | 235 |
226 } // namespace sql | 236 } // namespace sql |
OLD | NEW |