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 #ifndef COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_BACKEND_H_ | 5 #ifndef COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_BACKEND_H_ |
6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_BACKEND_H_ | 6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_BACKEND_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 protected: | 90 protected: |
91 friend class base::RefCountedDeleteOnMessageLoop<WebDatabaseBackend>; | 91 friend class base::RefCountedDeleteOnMessageLoop<WebDatabaseBackend>; |
92 friend class base::DeleteHelper<WebDatabaseBackend>; | 92 friend class base::DeleteHelper<WebDatabaseBackend>; |
93 | 93 |
94 virtual ~WebDatabaseBackend(); | 94 virtual ~WebDatabaseBackend(); |
95 | 95 |
96 private: | 96 private: |
97 // Invoked on a db error. | 97 // Invoked on a db error. |
98 void DatabaseErrorCallback(int error, sql::Statement* statement); | 98 void DatabaseErrorCallback(int error, sql::Statement* statement); |
99 | 99 |
| 100 // In the case of a catastrophic DB error, this will be called to recreate the |
| 101 // corrupt database. |
| 102 void RazeAndCloseDatabase(); |
| 103 |
100 // Commit the current transaction. | 104 // Commit the current transaction. |
101 void Commit(); | 105 void Commit(); |
102 | 106 |
103 // Path to database file. | 107 // Path to database file. |
104 base::FilePath db_path_; | 108 base::FilePath db_path_; |
105 | 109 |
106 // The tables that participate in managing the database. These are | 110 // The tables that participate in managing the database. These are |
107 // owned here but other than that this class does nothing with | 111 // owned here but other than that this class does nothing with |
108 // them. Their initialization is in whatever factory creates | 112 // them. Their initialization is in whatever factory creates |
109 // WebDatabaseService, and lookup by type is provided by the | 113 // WebDatabaseService, and lookup by type is provided by the |
(...skipping 24 matching lines...) Expand all Loading... |
134 // diagnostic information. | 138 // diagnostic information. |
135 std::string diagnostics_; | 139 std::string diagnostics_; |
136 | 140 |
137 // Delegate. See the class definition above for more information. | 141 // Delegate. See the class definition above for more information. |
138 std::unique_ptr<Delegate> delegate_; | 142 std::unique_ptr<Delegate> delegate_; |
139 | 143 |
140 DISALLOW_COPY_AND_ASSIGN(WebDatabaseBackend); | 144 DISALLOW_COPY_AND_ASSIGN(WebDatabaseBackend); |
141 }; | 145 }; |
142 | 146 |
143 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_BACKEND_H_ | 147 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_BACKEND_H_ |
OLD | NEW |