| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 const GURL& url); | 200 const GURL& url); |
| 201 | 201 |
| 202 static PrerenderManagerMode GetMode(); | 202 static PrerenderManagerMode GetMode(); |
| 203 static void SetMode(PrerenderManagerMode mode); | 203 static void SetMode(PrerenderManagerMode mode); |
| 204 static const char* GetModeString(); | 204 static const char* GetModeString(); |
| 205 static bool IsPrerenderingPossible(); | 205 static bool IsPrerenderingPossible(); |
| 206 static bool ActuallyPrerendering(); | 206 static bool ActuallyPrerendering(); |
| 207 static bool IsControlGroup(); | 207 static bool IsControlGroup(); |
| 208 static bool IsNoUseGroup(); | 208 static bool IsNoUseGroup(); |
| 209 static bool IsNoStatePrefetch(); | 209 static bool IsNoStatePrefetch(); |
| 210 bool IsPrerenderSilenceExperiment(); |
| 210 | 211 |
| 211 // Query the list of current prerender pages to see if the given web contents | 212 // Query the list of current prerender pages to see if the given web contents |
| 212 // is prerendering a page. The optional parameter |origin| is an output | 213 // is prerendering a page. The optional parameter |origin| is an output |
| 213 // parameter which, if a prerender is found, is set to the Origin of the | 214 // parameter which, if a prerender is found, is set to the Origin of the |
| 214 // prerender |web_contents|. | 215 // prerender |web_contents|. |
| 215 bool IsWebContentsPrerendering(const content::WebContents* web_contents, | 216 bool IsWebContentsPrerendering(const content::WebContents* web_contents, |
| 216 Origin* origin) const; | 217 Origin* origin) const; |
| 217 | 218 |
| 218 // Whether the PrerenderManager has an active prerender with the given url and | 219 // Whether the PrerenderManager has an active prerender with the given url and |
| 219 // SessionStorageNamespace associated with the given WebContents. | 220 // SessionStorageNamespace associated with the given WebContents. |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 390 |
| 390 // Same as base::SysInfo::IsLowEndDevice(), overridden in tests. | 391 // Same as base::SysInfo::IsLowEndDevice(), overridden in tests. |
| 391 virtual bool IsLowEndDevice() const; | 392 virtual bool IsLowEndDevice() const; |
| 392 | 393 |
| 393 private: | 394 private: |
| 394 friend class PrerenderBrowserTest; | 395 friend class PrerenderBrowserTest; |
| 395 friend class PrerenderContents; | 396 friend class PrerenderContents; |
| 396 friend class PrerenderHandle; | 397 friend class PrerenderHandle; |
| 397 friend class UnitTestPrerenderManager; | 398 friend class UnitTestPrerenderManager; |
| 398 | 399 |
| 400 // For testing |AddPrerender()| by iterating via a list of origins. |
| 401 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, PrerenderSilenceDisallowsNonOffline); |
| 402 |
| 399 class OnCloseWebContentsDeleter; | 403 class OnCloseWebContentsDeleter; |
| 400 struct NavigationRecord; | 404 struct NavigationRecord; |
| 401 using PrerenderDataVector = std::vector<std::unique_ptr<PrerenderData>>; | 405 using PrerenderDataVector = std::vector<std::unique_ptr<PrerenderData>>; |
| 402 | 406 |
| 403 // Time interval before a new prerender is allowed. | 407 // Time interval before a new prerender is allowed. |
| 404 static const int kMinTimeBetweenPrerendersMs = 500; | 408 static const int kMinTimeBetweenPrerendersMs = 500; |
| 405 | 409 |
| 406 // Time window for which we record old navigations, in milliseconds. | 410 // Time window for which we record old navigations, in milliseconds. |
| 407 static const int kNavigationRecordWindowMs = 5000; | 411 static const int kNavigationRecordWindowMs = 5000; |
| 408 | 412 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 // Set of process hosts being prerendered. | 567 // Set of process hosts being prerendered. |
| 564 using PrerenderProcessSet = std::set<content::RenderProcessHost*>; | 568 using PrerenderProcessSet = std::set<content::RenderProcessHost*>; |
| 565 PrerenderProcessSet prerender_process_hosts_; | 569 PrerenderProcessSet prerender_process_hosts_; |
| 566 | 570 |
| 567 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 571 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 568 }; | 572 }; |
| 569 | 573 |
| 570 } // namespace prerender | 574 } // namespace prerender |
| 571 | 575 |
| 572 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 576 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |