| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // views of web pages. All methods must be called on the UI thread unless | 76 // views of web pages. All methods must be called on the UI thread unless |
| 77 // indicated otherwise. | 77 // indicated otherwise. |
| 78 class PrerenderManager : public content::NotificationObserver, | 78 class PrerenderManager : public content::NotificationObserver, |
| 79 public content::RenderProcessHostObserver, | 79 public content::RenderProcessHostObserver, |
| 80 public KeyedService, | 80 public KeyedService, |
| 81 public MediaCaptureDevicesDispatcher::Observer { | 81 public MediaCaptureDevicesDispatcher::Observer { |
| 82 public: | 82 public: |
| 83 enum PrerenderManagerMode { | 83 enum PrerenderManagerMode { |
| 84 PRERENDER_MODE_DISABLED, | 84 PRERENDER_MODE_DISABLED, |
| 85 PRERENDER_MODE_ENABLED, | 85 PRERENDER_MODE_ENABLED, |
| 86 PRERENDER_MODE_NOSTATE_PREFETCH | 86 PRERENDER_MODE_NOSTATE_PREFETCH, |
| 87 // Like PRERENDER_MODE_DISABLED, but keeps track of pages that would have |
| 88 // been prerendered and records metrics for comparison with other modes. |
| 89 PRERENDER_MODE_SIMPLE_LOAD_EXPERIMENT |
| 87 }; | 90 }; |
| 88 | 91 |
| 89 // One or more of these flags must be passed to ClearData() to specify just | 92 // One or more of these flags must be passed to ClearData() to specify just |
| 90 // what data to clear. See function declaration for more information. | 93 // what data to clear. See function declaration for more information. |
| 91 enum ClearFlags { | 94 enum ClearFlags { |
| 92 CLEAR_PRERENDER_CONTENTS = 0x1 << 0, | 95 CLEAR_PRERENDER_CONTENTS = 0x1 << 0, |
| 93 CLEAR_PRERENDER_HISTORY = 0x1 << 1, | 96 CLEAR_PRERENDER_HISTORY = 0x1 << 1, |
| 94 CLEAR_MAX = 0x1 << 2 | 97 CLEAR_MAX = 0x1 << 2 |
| 95 }; | 98 }; |
| 96 | 99 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // |is_no_store| must be true if the main resource has a "no-store" cache | 218 // |is_no_store| must be true if the main resource has a "no-store" cache |
| 216 // control HTTP header. | 219 // control HTTP header. |
| 217 void RecordFirstContentfulPaint(const GURL& url, | 220 void RecordFirstContentfulPaint(const GURL& url, |
| 218 bool is_no_store, | 221 bool is_no_store, |
| 219 base::TimeDelta time); | 222 base::TimeDelta time); |
| 220 | 223 |
| 221 static PrerenderManagerMode GetMode(); | 224 static PrerenderManagerMode GetMode(); |
| 222 static void SetMode(PrerenderManagerMode mode); | 225 static void SetMode(PrerenderManagerMode mode); |
| 223 static bool IsPrerenderingPossible(); | 226 static bool IsPrerenderingPossible(); |
| 224 static bool IsNoStatePrefetch(); | 227 static bool IsNoStatePrefetch(); |
| 228 static bool IsSimpleLoadExperiment(); |
| 225 | 229 |
| 226 // Query the list of current prerender pages to see if the given web contents | 230 // Query the list of current prerender pages to see if the given web contents |
| 227 // is prerendering a page. The optional parameter |origin| is an output | 231 // is prerendering a page. The optional parameter |origin| is an output |
| 228 // parameter which, if a prerender is found, is set to the Origin of the | 232 // parameter which, if a prerender is found, is set to the Origin of the |
| 229 // prerender |web_contents|. | 233 // prerender |web_contents|. |
| 230 bool IsWebContentsPrerendering(const content::WebContents* web_contents, | 234 bool IsWebContentsPrerendering(const content::WebContents* web_contents, |
| 231 Origin* origin) const; | 235 Origin* origin) const; |
| 232 | 236 |
| 233 // Whether the PrerenderManager has an active prerender with the given url and | 237 // Whether the PrerenderManager has an active prerender with the given url and |
| 234 // SessionStorageNamespace associated with the given WebContents. | 238 // SessionStorageNamespace associated with the given WebContents. |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 std::unique_ptr<base::TickClock> tick_clock_; | 605 std::unique_ptr<base::TickClock> tick_clock_; |
| 602 | 606 |
| 603 base::WeakPtrFactory<PrerenderManager> weak_factory_; | 607 base::WeakPtrFactory<PrerenderManager> weak_factory_; |
| 604 | 608 |
| 605 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 609 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 606 }; | 610 }; |
| 607 | 611 |
| 608 } // namespace prerender | 612 } // namespace prerender |
| 609 | 613 |
| 610 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 614 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |