OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_HISTORY_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ |
6 #define CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ |
7 | 7 |
| 8 #include "build/build_config.h" |
8 #include "chrome/browser/history/download_database.h" | 9 #include "chrome/browser/history/download_database.h" |
9 #include "chrome/browser/history/history_types.h" | 10 #include "chrome/browser/history/history_types.h" |
10 #include "chrome/browser/history/starred_url_database.h" | 11 #include "chrome/browser/history/starred_url_database.h" |
11 #include "chrome/browser/history/url_database.h" | 12 #include "chrome/browser/history/url_database.h" |
12 #include "chrome/browser/history/visit_database.h" | 13 #include "chrome/browser/history/visit_database.h" |
13 #include "chrome/browser/history/visitsegment_database.h" | 14 #include "chrome/browser/history/visitsegment_database.h" |
14 #include "chrome/browser/meta_table_helper.h" | 15 #include "chrome/browser/meta_table_helper.h" |
15 | 16 |
16 struct sqlite3; | 17 struct sqlite3; |
17 | 18 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // | 104 // |
104 // This will also recreate the supplementary URL indices, since these | 105 // This will also recreate the supplementary URL indices, since these |
105 // indices won't be created automatically when using the temporary URL | 106 // indices won't be created automatically when using the temporary URL |
106 // table (what the caller does right before calling this). | 107 // table (what the caller does right before calling this). |
107 bool RecreateAllTablesButURL(); | 108 bool RecreateAllTablesButURL(); |
108 | 109 |
109 // Vacuums the database. This will cause sqlite to defragment and collect | 110 // Vacuums the database. This will cause sqlite to defragment and collect |
110 // unused space in the file. It can be VERY SLOW. | 111 // unused space in the file. It can be VERY SLOW. |
111 void Vacuum(); | 112 void Vacuum(); |
112 | 113 |
| 114 // Returns true if the history backend should erase the full text search |
| 115 // and archived history files as part of version 16 -> 17 migration. The |
| 116 // time format changed in this revision, and these files would be much slower |
| 117 // to migrate. Since the data is less important, they should be deleted. |
| 118 // |
| 119 // This flag will be valid after Init() is called. It will always be false |
| 120 // when running on Windows. |
| 121 bool needs_version_17_migration() const { |
| 122 return needs_version_17_migration_; |
| 123 } |
| 124 |
113 // Visit table functions ---------------------------------------------------- | 125 // Visit table functions ---------------------------------------------------- |
114 | 126 |
115 // Update the segment id of a visit. Return true on success. | 127 // Update the segment id of a visit. Return true on success. |
116 bool SetSegmentID(VisitID visit_id, SegmentID segment_id); | 128 bool SetSegmentID(VisitID visit_id, SegmentID segment_id); |
117 | 129 |
118 // Query the segment ID for the provided visit. Return 0 on failure or if the | 130 // Query the segment ID for the provided visit. Return 0 on failure or if the |
119 // visit id wasn't found. | 131 // visit id wasn't found. |
120 SegmentID GetSegmentID(VisitID visit_id); | 132 SegmentID GetSegmentID(VisitID visit_id); |
121 | 133 |
122 // Retrieves/Updates early expiration threshold, which specifies the earliest | 134 // Retrieves/Updates early expiration threshold, which specifies the earliest |
(...skipping 14 matching lines...) Expand all Loading... |
137 | 149 |
138 // Makes sure the version is up-to-date, updating if necessary. If the | 150 // Makes sure the version is up-to-date, updating if necessary. If the |
139 // database is too old to migrate, the user will be notified. In this case, or | 151 // database is too old to migrate, the user will be notified. In this case, or |
140 // for other errors, false will be returned. True means it is up-to-date and | 152 // for other errors, false will be returned. True means it is up-to-date and |
141 // ready for use. | 153 // ready for use. |
142 // | 154 // |
143 // This assumes it is called from the init function inside a transaction. It | 155 // This assumes it is called from the init function inside a transaction. It |
144 // may commit the transaction and start a new one if migration requires it. | 156 // may commit the transaction and start a new one if migration requires it. |
145 InitStatus EnsureCurrentVersion(const FilePath& tmp_bookmarks_path); | 157 InitStatus EnsureCurrentVersion(const FilePath& tmp_bookmarks_path); |
146 | 158 |
| 159 #if !defined(OS_WIN) |
| 160 // Converts the time epoch in the database from being 1970-based to being |
| 161 // 1601-based which corresponds to the change in Time.internal_value_. |
| 162 void MigrateTimeEpoch(); |
| 163 #endif |
| 164 |
147 // --------------------------------------------------------------------------- | 165 // --------------------------------------------------------------------------- |
148 | 166 |
149 // How many nested transactions are pending? When this gets to 0, we commit. | 167 // How many nested transactions are pending? When this gets to 0, we commit. |
150 int transaction_nesting_; | 168 int transaction_nesting_; |
151 | 169 |
152 // The database. The closer automatically closes the deletes the db and the | 170 // The database. The closer automatically closes the deletes the db and the |
153 // statement cache. These must be done in a specific order, so we don't want | 171 // statement cache. These must be done in a specific order, so we don't want |
154 // to rely on C++'s implicit destructors for the individual objects. | 172 // to rely on C++'s implicit destructors for the individual objects. |
155 // | 173 // |
156 // The close scoper will free the database and delete the statement cache in | 174 // The close scoper will free the database and delete the statement cache in |
157 // the correct order automatically when we are destroyed. | 175 // the correct order automatically when we are destroyed. |
158 DBCloseScoper db_closer_; | 176 DBCloseScoper db_closer_; |
159 sqlite3* db_; | 177 sqlite3* db_; |
160 SqliteStatementCache* statement_cache_; | 178 SqliteStatementCache* statement_cache_; |
161 | 179 |
162 MetaTableHelper meta_table_; | 180 MetaTableHelper meta_table_; |
163 base::Time cached_early_expiration_threshold_; | 181 base::Time cached_early_expiration_threshold_; |
164 | 182 |
| 183 // See the getter above. |
| 184 bool needs_version_17_migration_; |
| 185 |
165 DISALLOW_COPY_AND_ASSIGN(HistoryDatabase); | 186 DISALLOW_COPY_AND_ASSIGN(HistoryDatabase); |
166 }; | 187 }; |
167 | 188 |
168 } // history | 189 } // history |
169 | 190 |
170 #endif // CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ | 191 #endif // CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ |
OLD | NEW |