| 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 30 matching lines...) Expand all Loading... |
| 41 struct ResourceRow { | 41 struct ResourceRow { |
| 42 ResourceRow(); | 42 ResourceRow(); |
| 43 ResourceRow(const ResourceRow& other); | 43 ResourceRow(const ResourceRow& other); |
| 44 ResourceRow(const std::string& main_frame_url, | 44 ResourceRow(const std::string& main_frame_url, |
| 45 const std::string& resource_url, | 45 const std::string& resource_url, |
| 46 content::ResourceType resource_type, | 46 content::ResourceType resource_type, |
| 47 int number_of_hits, | 47 int number_of_hits, |
| 48 int number_of_misses, | 48 int number_of_misses, |
| 49 int consecutive_misses, | 49 int consecutive_misses, |
| 50 double average_position, | 50 double average_position, |
| 51 net::RequestPriority priority); | 51 net::RequestPriority priority, |
| 52 bool has_validators, |
| 53 bool always_revalidate); |
| 52 void UpdateScore(); | 54 void UpdateScore(); |
| 53 bool operator==(const ResourceRow& rhs) const; | 55 bool operator==(const ResourceRow& rhs) const; |
| 54 | 56 |
| 55 // Stores the host for host based data, main frame Url for the Url based | 57 // Stores the host for host based data, main frame Url for the Url based |
| 56 // data. This field is cleared for efficiency reasons and the code outside | 58 // data. This field is cleared for efficiency reasons and the code outside |
| 57 // this class should not assume it is set. | 59 // this class should not assume it is set. |
| 58 std::string primary_key; | 60 std::string primary_key; |
| 59 | 61 |
| 60 GURL resource_url; | 62 GURL resource_url; |
| 61 content::ResourceType resource_type; | 63 content::ResourceType resource_type; |
| 62 size_t number_of_hits; | 64 size_t number_of_hits; |
| 63 size_t number_of_misses; | 65 size_t number_of_misses; |
| 64 size_t consecutive_misses; | 66 size_t consecutive_misses; |
| 65 double average_position; | 67 double average_position; |
| 66 net::RequestPriority priority; | 68 net::RequestPriority priority; |
| 69 bool has_validators; |
| 70 bool always_revalidate; |
| 67 | 71 |
| 68 // Not stored. | 72 // Not stored. |
| 69 float score; | 73 float score; |
| 70 }; | 74 }; |
| 71 typedef std::vector<ResourceRow> ResourceRows; | 75 typedef std::vector<ResourceRow> ResourceRows; |
| 72 | 76 |
| 73 // Sorts the ResourceRows by score, descending. | 77 // Sorts the ResourceRows by score, descending. |
| 74 struct ResourceRowSorter { | 78 struct ResourceRowSorter { |
| 75 bool operator()(const ResourceRow& x, const ResourceRow& y) const; | 79 bool operator()(const ResourceRow& x, const ResourceRow& y) const; |
| 76 }; | 80 }; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 sql::Statement* GetHostResourceUpdateStatement(); | 162 sql::Statement* GetHostResourceUpdateStatement(); |
| 159 sql::Statement* GetHostMetadataDeleteStatement(); | 163 sql::Statement* GetHostMetadataDeleteStatement(); |
| 160 sql::Statement* GetHostMetadataUpdateStatement(); | 164 sql::Statement* GetHostMetadataUpdateStatement(); |
| 161 | 165 |
| 162 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictorTables); | 166 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictorTables); |
| 163 }; | 167 }; |
| 164 | 168 |
| 165 } // namespace predictors | 169 } // namespace predictors |
| 166 | 170 |
| 167 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TABLES_H_ | 171 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TABLES_H_ |
| OLD | NEW |