| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TABLES_H_ | 5 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TABLES_H_ |
| 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TABLES_H_ | 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TABLES_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 private: | 133 private: |
| 134 friend class PredictorDatabaseInternal; | 134 friend class PredictorDatabaseInternal; |
| 135 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTablesTest, | 135 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTablesTest, |
| 136 DatabaseVersionIsSet); | 136 DatabaseVersionIsSet); |
| 137 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTablesTest, | 137 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTablesTest, |
| 138 DatabaseIsResetWhenIncompatible); | 138 DatabaseIsResetWhenIncompatible); |
| 139 | 139 |
| 140 // Database version. Always increment it when any change is made to the data | 140 // Database version. Always increment it when any change is made to the data |
| 141 // schema (including the .proto). | 141 // schema (including the .proto). |
| 142 static constexpr int kDatabaseVersion = 8; | 142 static constexpr int kDatabaseVersion = 9; |
| 143 | 143 |
| 144 // PredictorTableBase: | 144 // PredictorTableBase: |
| 145 void CreateTableIfNonExistent() override; | 145 void CreateTableIfNonExistent() override; |
| 146 void LogDatabaseStats() override; | 146 void LogDatabaseStats() override; |
| 147 | 147 |
| 148 static bool DropTablesIfOutdated(sql::Connection* db); | 148 static bool DropTablesIfOutdated(sql::Connection* db); |
| 149 static int GetDatabaseVersion(sql::Connection* db); | 149 static int GetDatabaseVersion(sql::Connection* db); |
| 150 static bool SetDatabaseVersion(sql::Connection* db, int version); | 150 static bool SetDatabaseVersion(sql::Connection* db, int version); |
| 151 | 151 |
| 152 std::unique_ptr<GlowplugKeyValueTable<PrefetchData>> url_resource_table_; | 152 std::unique_ptr<GlowplugKeyValueTable<PrefetchData>> url_resource_table_; |
| 153 std::unique_ptr<GlowplugKeyValueTable<RedirectData>> url_redirect_table_; | 153 std::unique_ptr<GlowplugKeyValueTable<RedirectData>> url_redirect_table_; |
| 154 std::unique_ptr<GlowplugKeyValueTable<PrefetchData>> host_resource_table_; | 154 std::unique_ptr<GlowplugKeyValueTable<PrefetchData>> host_resource_table_; |
| 155 std::unique_ptr<GlowplugKeyValueTable<RedirectData>> host_redirect_table_; | 155 std::unique_ptr<GlowplugKeyValueTable<RedirectData>> host_redirect_table_; |
| 156 std::unique_ptr<GlowplugKeyValueTable<precache::PrecacheManifest>> | 156 std::unique_ptr<GlowplugKeyValueTable<precache::PrecacheManifest>> |
| 157 manifest_table_; | 157 manifest_table_; |
| 158 std::unique_ptr<GlowplugKeyValueTable<OriginData>> origin_table_; | 158 std::unique_ptr<GlowplugKeyValueTable<OriginData>> origin_table_; |
| 159 | 159 |
| 160 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictorTables); | 160 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictorTables); |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 } // namespace predictors | 163 } // namespace predictors |
| 164 | 164 |
| 165 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TABLES_H_ | 165 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TABLES_H_ |
| OLD | NEW |