Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: chrome/browser/predictors/resource_prefetch_predictor_tables.h

Issue 2762673002: predictors: Pass manifests from Bork to store in ResourcePrefetchPredictor. (Closed)
Patch Set: Rebase. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // Computes score of |data|. 97 // Computes score of |data|.
98 static float ComputeResourceScore(const ResourceData& data); 98 static float ComputeResourceScore(const ResourceData& data);
99 99
100 // Removes the redirects with more than |max_consecutive_misses| consecutive 100 // Removes the redirects with more than |max_consecutive_misses| consecutive
101 // misses from |data|. 101 // misses from |data|.
102 static void TrimRedirects(RedirectData* data, size_t max_consecutive_misses); 102 static void TrimRedirects(RedirectData* data, size_t max_consecutive_misses);
103 103
104 // The maximum length of the string that can be stored in the DB. 104 // The maximum length of the string that can be stored in the DB.
105 static constexpr size_t kMaxStringLength = 1024; 105 static constexpr size_t kMaxStringLength = 1024;
106 106
107 // The maximum size in bytes of the manifest that can be stored in the DB.
108 static constexpr size_t kMaxManifestByteSize = 16384; // 16 KB
Benoit L 2017/03/20 16:51:53 tiny nit: 16 * (1 << 10)? Then you can drop the co
alexilin 2017/03/21 09:50:34 Done.
109
107 protected: 110 protected:
108 // Protected for testing. Use PredictorDatabase::resource_prefetch_tables() 111 // Protected for testing. Use PredictorDatabase::resource_prefetch_tables()
109 // instead of this constructor. 112 // instead of this constructor.
110 ResourcePrefetchPredictorTables(); 113 ResourcePrefetchPredictorTables();
111 ~ResourcePrefetchPredictorTables() override; 114 ~ResourcePrefetchPredictorTables() override;
112 115
113 private: 116 private:
114 // Represents the type of information that is stored in prefetch database. 117 // Represents the type of information that is stored in prefetch database.
115 enum class PrefetchDataType { RESOURCE, REDIRECT, MANIFEST }; 118 enum class PrefetchDataType { RESOURCE, REDIRECT, MANIFEST };
116 119
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 161
159 static const char* GetTableName(PrefetchKeyType key_type, 162 static const char* GetTableName(PrefetchKeyType key_type,
160 PrefetchDataType data_type); 163 PrefetchDataType data_type);
161 164
162 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictorTables); 165 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictorTables);
163 }; 166 };
164 167
165 } // namespace predictors 168 } // namespace predictors
166 169
167 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TABLES_H_ 170 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TABLES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698