OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PRERENDER_PRERENDER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // and substitutes the prerendered RVH into the TabContents. |opener_url| is | 121 // and substitutes the prerendered RVH into the TabContents. |opener_url| is |
122 // set to the window.opener url that the TabContents should have set and | 122 // set to the window.opener url that the TabContents should have set and |
123 // will be empty if there is no opener set. Returns whether or not a | 123 // will be empty if there is no opener set. Returns whether or not a |
124 // prerendered RVH could be used or not. | 124 // prerendered RVH could be used or not. |
125 bool MaybeUsePrerenderedPage(TabContents* tab_contents, | 125 bool MaybeUsePrerenderedPage(TabContents* tab_contents, |
126 const GURL& url, | 126 const GURL& url, |
127 const GURL& opener_url); | 127 const GURL& opener_url); |
128 | 128 |
129 // Moves a PrerenderContents to the pending delete list from the list of | 129 // Moves a PrerenderContents to the pending delete list from the list of |
130 // active prerenders when prerendering should be cancelled. | 130 // active prerenders when prerendering should be cancelled. |
131 void MoveEntryToPendingDelete(PrerenderContents* entry); | 131 void MoveEntryToPendingDelete(PrerenderContents* entry, |
| 132 FinalStatus final_status); |
132 | 133 |
133 // Records the perceived page load time for a page - effectively the time from | 134 // Records the perceived page load time for a page - effectively the time from |
134 // when the user navigates to a page to when it finishes loading. The actual | 135 // when the user navigates to a page to when it finishes loading. The actual |
135 // load may have started prior to navigation due to prerender hints. | 136 // load may have started prior to navigation due to prerender hints. |
136 // This must be called on the UI thread. | 137 // This must be called on the UI thread. |
137 static void RecordPerceivedPageLoadTime( | 138 static void RecordPerceivedPageLoadTime( |
138 base::TimeDelta perceived_page_load_time, | 139 base::TimeDelta perceived_page_load_time, |
139 TabContents* tab_contents, | 140 TabContents* tab_contents, |
140 const GURL& url); | 141 const GURL& url); |
141 | 142 |
142 // Returns whether prerendering is currently enabled for this manager. | 143 // Returns whether prerendering is currently enabled for this manager. |
143 // Must be called on the UI thread. | 144 // Must be called on the UI thread. |
144 bool is_enabled() const; | 145 bool is_enabled() const; |
145 | 146 |
146 // Set whether prerendering is currently enabled for this manager. | 147 // Set whether prerendering is currently enabled for this manager. |
147 // Must be called on the UI thread. | 148 // Must be called on the UI thread. |
148 // If |enabled| is false, existing prerendered pages will still persist until | 149 // If |enabled| is false, existing prerendered pages will still persist until |
149 // they time out, but new ones will not be generated. | 150 // they time out, but new ones will not be generated. |
150 void set_enabled(bool enabled); | 151 void set_enabled(bool enabled); |
151 | 152 |
152 static PrerenderManagerMode GetMode(); | 153 static PrerenderManagerMode GetMode(); |
153 static void SetMode(PrerenderManagerMode mode); | 154 static void SetMode(PrerenderManagerMode mode); |
154 static bool IsPrerenderingPossible(); | 155 static bool IsPrerenderingPossible(); |
| 156 static bool ActuallyPrerendering(); |
155 static bool IsControlGroup(); | 157 static bool IsControlGroup(); |
156 | 158 |
157 // Query the list of current prerender pages to see if the given tab contents | 159 // Query the list of current prerender pages to see if the given tab contents |
158 // is prerendering a page. | 160 // is prerendering a page. |
159 bool IsTabContentsPrerendering(TabContents* tab_contents) const; | 161 bool IsTabContentsPrerendering(TabContents* tab_contents) const; |
160 | 162 |
161 // Maintaining and querying the set of TabContents belonging to this | 163 // Maintaining and querying the set of TabContents belonging to this |
162 // PrerenderManager that are currently showing prerendered pages. | 164 // PrerenderManager that are currently showing prerendered pages. |
163 void MarkTabContentsAsPrerendered(TabContents* tab_contents); | 165 void MarkTabContentsAsPrerendered(TabContents* tab_contents); |
164 void MarkTabContentsAsWouldBePrerendered(TabContents* tab_contents); | 166 void MarkTabContentsAsWouldBePrerendered(TabContents* tab_contents); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // prerendered from the given child route id pair. | 324 // prerendered from the given child route id pair. |
323 std::list<PrerenderContentsData>::iterator | 325 std::list<PrerenderContentsData>::iterator |
324 FindPrerenderContentsForChildRouteIdPair( | 326 FindPrerenderContentsForChildRouteIdPair( |
325 const std::pair<int, int>& child_route_id_pair); | 327 const std::pair<int, int>& child_route_id_pair); |
326 | 328 |
327 // Returns whether the PrerenderManager is currently within the prerender | 329 // Returns whether the PrerenderManager is currently within the prerender |
328 // window - effectively, up to 30 seconds after a prerender tag has been | 330 // window - effectively, up to 30 seconds after a prerender tag has been |
329 // observed. | 331 // observed. |
330 bool WithinWindow() const; | 332 bool WithinWindow() const; |
331 | 333 |
| 334 // Indicates whether a Prerender has been cancelled such that we need |
| 335 // a dummy replacement for the purpose of recording the correct PPLT for |
| 336 // the Match Complete case. |
| 337 bool NeedMatchCompleteDummyForFinalStatus(FinalStatus final_status) const; |
| 338 |
332 bool DoesRateLimitAllowPrerender() const; | 339 bool DoesRateLimitAllowPrerender() const; |
333 | 340 |
334 // Deletes old TabContents that have been replaced by prerendered ones. This | 341 // Deletes old TabContents that have been replaced by prerendered ones. This |
335 // is needed because they're replaced in a callback from the old TabContents, | 342 // is needed because they're replaced in a callback from the old TabContents, |
336 // so cannot immediately be deleted. | 343 // so cannot immediately be deleted. |
337 void DeleteOldTabContents(); | 344 void DeleteOldTabContents(); |
338 | 345 |
339 // Cleans up old NavigationRecord's. | 346 // Cleans up old NavigationRecord's. |
340 void CleanUpOldNavigations(); | 347 void CleanUpOldNavigations(); |
341 | 348 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 429 |
423 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 430 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
424 }; | 431 }; |
425 | 432 |
426 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 433 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
427 int render_process_id); | 434 int render_process_id); |
428 | 435 |
429 } // namespace prerender | 436 } // namespace prerender |
430 | 437 |
431 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 438 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |