Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: components/webdata/common/web_database_backend.h

Issue 2225333003: Recreate the WebData database on a catastrophic SQL error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: derat's comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | components/webdata/common/web_database_backend.cc » ('j') | components/webdata/common/web_database_backend.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698