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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 // Computes score of |data|. | 133 // Computes score of |data|. |
134 static float ComputeResourceScore(const ResourceData& data); | 134 static float ComputeResourceScore(const ResourceData& data); |
135 | 135 |
136 // PredictorTableBase methods. | 136 // PredictorTableBase methods. |
137 void CreateTableIfNonExistent() override; | 137 void CreateTableIfNonExistent() override; |
138 void LogDatabaseStats() override; | 138 void LogDatabaseStats() override; |
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 = 4; | 142 static constexpr int kDatabaseVersion = 5; |
143 | 143 |
144 static bool DropTablesIfOutdated(sql::Connection* db); | 144 static bool DropTablesIfOutdated(sql::Connection* db); |
145 static int GetDatabaseVersion(sql::Connection* db); | 145 static int GetDatabaseVersion(sql::Connection* db); |
146 static bool SetDatabaseVersion(sql::Connection* db, int version); | 146 static bool SetDatabaseVersion(sql::Connection* db, int version); |
147 | 147 |
148 // Helper to return Statements for cached Statements. | 148 // Helper to return Statements for cached Statements. |
149 std::unique_ptr<sql::Statement> GetTableUpdateStatement( | 149 std::unique_ptr<sql::Statement> GetTableUpdateStatement( |
150 PrefetchKeyType key_type, | 150 PrefetchKeyType key_type, |
151 PrefetchDataType data_type, | 151 PrefetchDataType data_type, |
152 TableOperationType op_type); | 152 TableOperationType op_type); |
153 | 153 |
154 static const char* GetTableName(PrefetchKeyType key_type, | 154 static const char* GetTableName(PrefetchKeyType key_type, |
155 PrefetchDataType data_type); | 155 PrefetchDataType data_type); |
156 | 156 |
157 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictorTables); | 157 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictorTables); |
158 }; | 158 }; |
159 | 159 |
160 } // namespace predictors | 160 } // namespace predictors |
161 | 161 |
162 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TABLES_H_ | 162 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TABLES_H_ |
OLD | NEW |