| 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 #ifndef CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ |
| 6 #define CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ | 6 #define CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/history/url_database.h" | 10 #include "chrome/browser/history/url_database.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // Transactions on the database. We support nested transactions and only | 36 // Transactions on the database. We support nested transactions and only |
| 37 // commit when the outermost one is committed (sqlite doesn't support true | 37 // commit when the outermost one is committed (sqlite doesn't support true |
| 38 // nested transactions). | 38 // nested transactions). |
| 39 void BeginTransaction(); | 39 void BeginTransaction(); |
| 40 void CommitTransaction(); | 40 void CommitTransaction(); |
| 41 | 41 |
| 42 // Returns the current version that we will generate archived databases with. | 42 // Returns the current version that we will generate archived databases with. |
| 43 static int GetCurrentVersion(); | 43 static int GetCurrentVersion(); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 bool DoInitTransaction(); |
| 47 |
| 46 // Implemented for the specialized databases. | 48 // Implemented for the specialized databases. |
| 47 virtual sql::Connection& GetDB() OVERRIDE; | 49 virtual sql::Connection& GetDB() OVERRIDE; |
| 48 | 50 |
| 49 // Makes sure the version is up-to-date, updating if necessary. If the | 51 // Makes sure the version is up-to-date, updating if necessary. If the |
| 50 // database is too old to migrate, the user will be notified. In this case, or | 52 // database is too old to migrate, the user will be notified. In this case, or |
| 51 // for other errors, false will be returned. True means it is up-to-date and | 53 // for other errors, false will be returned. True means it is up-to-date and |
| 52 // ready for use. | 54 // ready for use. |
| 53 // | 55 // |
| 54 // This assumes it is called from the init function inside a transaction. It | 56 // This assumes it is called from the init function inside a transaction. It |
| 55 // may commit the transaction and start a new one if migration requires it. | 57 // may commit the transaction and start a new one if migration requires it. |
| 56 sql::InitStatus EnsureCurrentVersion(); | 58 sql::InitStatus EnsureCurrentVersion(); |
| 57 | 59 |
| 58 // The database. | 60 // The database. |
| 59 sql::Connection db_; | 61 sql::Connection db_; |
| 60 sql::MetaTable meta_table_; | 62 sql::MetaTable meta_table_; |
| 61 | 63 |
| 62 DISALLOW_COPY_AND_ASSIGN(ArchivedDatabase); | 64 DISALLOW_COPY_AND_ASSIGN(ArchivedDatabase); |
| 63 }; | 65 }; |
| 64 | 66 |
| 65 } // namespace history | 67 } // namespace history |
| 66 | 68 |
| 67 #endif // CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ | 69 #endif // CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ |
| OLD | NEW |