Chromium Code Reviews| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 class PrerenderLocalPredictor; | 73 class PrerenderLocalPredictor; |
| 74 | 74 |
| 75 // PrerenderManager is responsible for initiating and keeping prerendered | 75 // PrerenderManager is responsible for initiating and keeping prerendered |
| 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 // NOTE: New values need to be appended, since they are used in histograms. | |
|
droger
2016/11/25 13:12:42
The histogram no longer exist in the code, but it
mattcary
2016/11/25 13:21:07
Does this change does mean that is will be nearly
droger
2016/11/25 13:44:36
Looking at histogram in UMA does not use the enum
pasko
2016/11/25 14:19:31
yeah, UMA dashbnoard does not know about enums in
| |
| 84 enum PrerenderManagerMode { | 83 enum PrerenderManagerMode { |
| 85 PRERENDER_MODE_DISABLED = 0, | 84 PRERENDER_MODE_DISABLED, |
| 86 PRERENDER_MODE_ENABLED = 1, | 85 PRERENDER_MODE_ENABLED, |
| 87 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP = 2, | 86 PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP, |
| 88 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP = 3, | 87 PRERENDER_MODE_NOSTATE_PREFETCH |
| 89 // Obsolete: PRERENDER_MODE_EXPERIMENT_5MIN_TTL_GROUP = 4, | |
| 90 PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP = 5, | |
| 91 PRERENDER_MODE_EXPERIMENT_MULTI_PRERENDER_GROUP = 6, | |
| 92 PRERENDER_MODE_EXPERIMENT_15MIN_TTL_GROUP = 7, | |
| 93 // Obsolete: PRERENDER_MODE_EXPERIMENT_MATCH_COMPLETE_GROUP = 8, | |
| 94 PRERENDER_MODE_NOSTATE_PREFETCH = 9, | |
| 95 PRERENDER_MODE_MAX = 10 | |
| 96 }; | 88 }; |
| 97 | 89 |
| 98 // One or more of these flags must be passed to ClearData() to specify just | 90 // One or more of these flags must be passed to ClearData() to specify just |
| 99 // what data to clear. See function declaration for more information. | 91 // what data to clear. See function declaration for more information. |
| 100 enum ClearFlags { | 92 enum ClearFlags { |
| 101 CLEAR_PRERENDER_CONTENTS = 0x1 << 0, | 93 CLEAR_PRERENDER_CONTENTS = 0x1 << 0, |
| 102 CLEAR_PRERENDER_HISTORY = 0x1 << 1, | 94 CLEAR_PRERENDER_HISTORY = 0x1 << 1, |
| 103 CLEAR_MAX = 0x1 << 2 | 95 CLEAR_MAX = 0x1 << 2 |
| 104 }; | 96 }; |
| 105 | 97 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 // Must not be called for prefetch loads (which are never rendered anyway). | 215 // Must not be called for prefetch loads (which are never rendered anyway). |
| 224 // |is_no_store| must be true if the main resource has a "no-store" cache | 216 // |is_no_store| must be true if the main resource has a "no-store" cache |
| 225 // control HTTP header. | 217 // control HTTP header. |
| 226 void RecordFirstContentfulPaint(const GURL& url, | 218 void RecordFirstContentfulPaint(const GURL& url, |
| 227 bool is_no_store, | 219 bool is_no_store, |
| 228 base::TimeDelta time); | 220 base::TimeDelta time); |
| 229 | 221 |
| 230 static PrerenderManagerMode GetMode(); | 222 static PrerenderManagerMode GetMode(); |
| 231 static void SetMode(PrerenderManagerMode mode); | 223 static void SetMode(PrerenderManagerMode mode); |
| 232 static bool IsPrerenderingPossible(); | 224 static bool IsPrerenderingPossible(); |
| 233 static bool ActuallyPrerendering(); | |
| 234 static bool IsControlGroup(); | |
| 235 static bool IsNoUseGroup(); | 225 static bool IsNoUseGroup(); |
| 236 static bool IsNoStatePrefetch(); | 226 static bool IsNoStatePrefetch(); |
| 237 | 227 |
| 238 // Query the list of current prerender pages to see if the given web contents | 228 // Query the list of current prerender pages to see if the given web contents |
| 239 // is prerendering a page. The optional parameter |origin| is an output | 229 // is prerendering a page. The optional parameter |origin| is an output |
| 240 // parameter which, if a prerender is found, is set to the Origin of the | 230 // parameter which, if a prerender is found, is set to the Origin of the |
| 241 // prerender |web_contents|. | 231 // prerender |web_contents|. |
| 242 bool IsWebContentsPrerendering(const content::WebContents* web_contents, | 232 bool IsWebContentsPrerendering(const content::WebContents* web_contents, |
| 243 Origin* origin) const; | 233 Origin* origin) const; |
| 244 | 234 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 613 std::unique_ptr<base::TickClock> tick_clock_; | 603 std::unique_ptr<base::TickClock> tick_clock_; |
| 614 | 604 |
| 615 base::WeakPtrFactory<PrerenderManager> weak_factory_; | 605 base::WeakPtrFactory<PrerenderManager> weak_factory_; |
| 616 | 606 |
| 617 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 607 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 618 }; | 608 }; |
| 619 | 609 |
| 620 } // namespace prerender | 610 } // namespace prerender |
| 621 | 611 |
| 622 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 612 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |