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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 scoped_ptr<Recovery> Recovery::Begin( | 108 scoped_ptr<Recovery> Recovery::Begin( |
109 Connection* connection, | 109 Connection* connection, |
110 const base::FilePath& db_path) { | 110 const base::FilePath& db_path) { |
111 scoped_ptr<Recovery> r(new Recovery(connection)); | 111 scoped_ptr<Recovery> r(new Recovery(connection)); |
112 if (!r->Init(db_path)) { | 112 if (!r->Init(db_path)) { |
113 // TODO(shess): Should Init() failure result in Raze()? | 113 // TODO(shess): Should Init() failure result in Raze()? |
114 r->Shutdown(POISON); | 114 r->Shutdown(POISON); |
115 return scoped_ptr<Recovery>(); | 115 return scoped_ptr<Recovery>(); |
116 } | 116 } |
117 | 117 |
118 return r.Pass(); | 118 return r; |
119 } | 119 } |
120 | 120 |
121 // static | 121 // static |
122 bool Recovery::Recovered(scoped_ptr<Recovery> r) { | 122 bool Recovery::Recovered(scoped_ptr<Recovery> r) { |
123 return r->Backup(); | 123 return r->Backup(); |
124 } | 124 } |
125 | 125 |
126 // static | 126 // static |
127 void Recovery::Unrecoverable(scoped_ptr<Recovery> r) { | 127 void Recovery::Unrecoverable(scoped_ptr<Recovery> r) { |
128 CHECK(r->db_); | 128 CHECK(r->db_); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 } | 527 } |
528 return false; | 528 return false; |
529 } | 529 } |
530 | 530 |
531 RecordRecoveryEvent(RECOVERY_SUCCESS_META_VERSION); | 531 RecordRecoveryEvent(RECOVERY_SUCCESS_META_VERSION); |
532 *version = recovery_version.ColumnInt(0); | 532 *version = recovery_version.ColumnInt(0); |
533 return true; | 533 return true; |
534 } | 534 } |
535 | 535 |
536 } // namespace sql | 536 } // namespace sql |
OLD | NEW |