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_COMMON_H_ | 5 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ |
6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ | 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 ResourcePrefetchPredictorConfig* config); | 27 ResourcePrefetchPredictorConfig* config); |
28 | 28 |
29 // Represents the type of key based on which prefetch data is stored. | 29 // Represents the type of key based on which prefetch data is stored. |
30 enum PrefetchKeyType { | 30 enum PrefetchKeyType { |
31 PREFETCH_KEY_TYPE_HOST, | 31 PREFETCH_KEY_TYPE_HOST, |
32 PREFETCH_KEY_TYPE_URL | 32 PREFETCH_KEY_TYPE_URL |
33 }; | 33 }; |
34 | 34 |
35 // Represents a single navigation for a render frame. | 35 // Represents a single navigation for a render frame. |
36 struct NavigationID { | 36 struct NavigationID { |
37 // TODO(shishir): Maybe take process_id, frame_id and url as input in | |
38 // constructor. | |
39 NavigationID(); | 37 NavigationID(); |
| 38 NavigationID(int render_process_id, |
| 39 int render_frame_id, |
| 40 const GURL& main_frame_url); |
40 NavigationID(const NavigationID& other); | 41 NavigationID(const NavigationID& other); |
41 explicit NavigationID(content::WebContents* web_contents); | 42 explicit NavigationID(content::WebContents* web_contents); |
42 bool operator<(const NavigationID& rhs) const; | 43 bool operator<(const NavigationID& rhs) const; |
43 bool operator==(const NavigationID& rhs) const; | 44 bool operator==(const NavigationID& rhs) const; |
44 | 45 |
45 bool IsSameRenderer(const NavigationID& other) const; | 46 bool IsSameRenderer(const NavigationID& other) const; |
46 | 47 |
47 // Returns true iff the render_process_id_, render_frame_id_ and | 48 // Returns true iff the render_process_id_, render_frame_id_ and |
48 // frame_url_ has been set correctly. | 49 // frame_url_ has been set correctly. |
49 bool is_valid() const; | 50 bool is_valid() const; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // Maximum number of prefetches that can be inflight for a single navigation. | 116 // Maximum number of prefetches that can be inflight for a single navigation. |
116 size_t max_prefetches_inflight_per_navigation; | 117 size_t max_prefetches_inflight_per_navigation; |
117 // Maximum number of prefetches that can be inflight for a host for a single | 118 // Maximum number of prefetches that can be inflight for a host for a single |
118 // navigation. | 119 // navigation. |
119 size_t max_prefetches_inflight_per_host_per_navigation; | 120 size_t max_prefetches_inflight_per_host_per_navigation; |
120 }; | 121 }; |
121 | 122 |
122 } // namespace predictors | 123 } // namespace predictors |
123 | 124 |
124 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ | 125 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ |
OLD | NEW |