| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // Records the perceived first contentful paint time for a prerendered page, | 234 // Records the perceived first contentful paint time for a prerendered page, |
| 235 // analogous to |RecordPerceivedPageLoadTime|. The FCP ticks is in absolute | 235 // analogous to |RecordPerceivedPageLoadTime|. The FCP ticks is in absolute |
| 236 // time; this has the disadvantage that the histogram will mix browser and | 236 // time; this has the disadvantage that the histogram will mix browser and |
| 237 // renderer ticks, but there seems to be no way around that. | 237 // renderer ticks, but there seems to be no way around that. |
| 238 void RecordPrerenderFirstContentfulPaint(const GURL& url, | 238 void RecordPrerenderFirstContentfulPaint(const GURL& url, |
| 239 content::WebContents* web_contents, | 239 content::WebContents* web_contents, |
| 240 bool is_no_store, | 240 bool is_no_store, |
| 241 bool was_hidden, | 241 bool was_hidden, |
| 242 base::TimeTicks ticks); | 242 base::TimeTicks ticks); |
| 243 | 243 |
| 244 static PrerenderManagerMode GetMode(); | 244 static PrerenderManagerMode GetMode(Origin origin); |
| 245 static void SetMode(PrerenderManagerMode mode); | 245 static void SetMode(PrerenderManagerMode mode); |
| 246 static bool IsPrerenderingPossible(); | 246 static void SetOmniboxMode(PrerenderManagerMode mode); |
| 247 static void SetInstantMode(PrerenderManagerMode mode); |
| 248 static bool IsAnyPrerenderingPossible(); |
| 247 static bool IsNoStatePrefetch(Origin origin); | 249 static bool IsNoStatePrefetch(Origin origin); |
| 248 static bool IsSimpleLoadExperiment(Origin origin); | 250 static bool IsSimpleLoadExperiment(Origin origin); |
| 249 | 251 |
| 250 // Query the list of current prerender pages to see if the given web contents | 252 // Query the list of current prerender pages to see if the given web contents |
| 251 // is prerendering a page. The optional parameter |origin| is an output | 253 // is prerendering a page. The optional parameter |origin| is an output |
| 252 // parameter which, if a prerender is found, is set to the Origin of the | 254 // parameter which, if a prerender is found, is set to the Origin of the |
| 253 // prerender |web_contents|. | 255 // prerender |web_contents|. |
| 254 bool IsWebContentsPrerendering(const content::WebContents* web_contents, | 256 bool IsWebContentsPrerendering(const content::WebContents* web_contents, |
| 255 Origin* origin) const; | 257 Origin* origin) const; |
| 256 | 258 |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 // List of recent navigations in this profile, sorted by ascending | 602 // List of recent navigations in this profile, sorted by ascending |
| 601 // |navigate_time_|. | 603 // |navigate_time_|. |
| 602 std::vector<NavigationRecord> navigations_; | 604 std::vector<NavigationRecord> navigations_; |
| 603 | 605 |
| 604 // List of recent prefetches, sorted by ascending navigate time. | 606 // List of recent prefetches, sorted by ascending navigate time. |
| 605 std::vector<NavigationRecord> prefetches_; | 607 std::vector<NavigationRecord> prefetches_; |
| 606 | 608 |
| 607 std::unique_ptr<PrerenderContents::Factory> prerender_contents_factory_; | 609 std::unique_ptr<PrerenderContents::Factory> prerender_contents_factory_; |
| 608 | 610 |
| 609 static PrerenderManagerMode mode_; | 611 static PrerenderManagerMode mode_; |
| 612 static PrerenderManagerMode instant_mode_; |
| 613 static PrerenderManagerMode omnibox_mode_; |
| 610 | 614 |
| 611 // A count of how many prerenders we do per session. Initialized to 0 then | 615 // A count of how many prerenders we do per session. Initialized to 0 then |
| 612 // incremented and emitted to a histogram on each successful prerender. | 616 // incremented and emitted to a histogram on each successful prerender. |
| 613 static int prerenders_per_session_count_; | 617 static int prerenders_per_session_count_; |
| 614 | 618 |
| 615 // RepeatingTimer to perform periodic cleanups of pending prerendered | 619 // RepeatingTimer to perform periodic cleanups of pending prerendered |
| 616 // pages. | 620 // pages. |
| 617 base::RepeatingTimer repeating_timer_; | 621 base::RepeatingTimer repeating_timer_; |
| 618 | 622 |
| 619 // Track time of last prerender to limit prerender spam. | 623 // Track time of last prerender to limit prerender spam. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 649 std::vector<std::unique_ptr<PrerenderManagerObserver>> observers_; | 653 std::vector<std::unique_ptr<PrerenderManagerObserver>> observers_; |
| 650 | 654 |
| 651 base::WeakPtrFactory<PrerenderManager> weak_factory_; | 655 base::WeakPtrFactory<PrerenderManager> weak_factory_; |
| 652 | 656 |
| 653 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 657 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 654 }; | 658 }; |
| 655 | 659 |
| 656 } // namespace prerender | 660 } // namespace prerender |
| 657 | 661 |
| 658 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 662 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |