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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
14 #include "base/gtest_prod_util.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/scoped_vector.h"
17 #include "base/memory/weak_ptr.h"
18 #include "base/threading/non_thread_safe.h"
19 #include "base/time/time.h"
20 #include "base/timer/timer.h"
21 #include "chrome/browser/history/history_service.h"
22 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
23 #include "chrome/browser/predictors/logged_in_predictor_table.h"
24 #include "chrome/browser/prerender/prerender_config.h"
25 #include "chrome/browser/prerender/prerender_contents.h"
26 #include "chrome/browser/prerender/prerender_events.h"
27 #include "chrome/browser/prerender/prerender_final_status.h"
28 #include "chrome/browser/prerender/prerender_histograms.h"
29 #include "chrome/browser/prerender/prerender_origin.h"
30 #include "chrome/browser/prerender/prerender_tracker.h"
31 #include "components/keyed_service/core/keyed_service.h"
32 #include "content/public/browser/notification_observer.h"
33 #include "content/public/browser/notification_registrar.h"
34 #include "content/public/browser/session_storage_namespace.h"
35 #include "content/public/browser/web_contents_observer.h"
36 #include "net/cookies/canonical_cookie.h"
37 #include "net/cookies/cookie_monster.h"
41 class InstantSearchPrerendererTest;
42 struct ChromeCookieDetails;
45 class DictionaryValue;
49 struct NavigateParams;
61 class URLRequestContextGetter;
66 class PrerenderCondition;
67 class PrerenderHandle;
68 class PrerenderHistory;
69 class PrerenderLocalPredictor;
71 // PrerenderManager is responsible for initiating and keeping prerendered
72 // views of web pages. All methods must be called on the UI thread unless
73 // indicated otherwise.
74 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
75 public base::NonThreadSafe,
76 public content::NotificationObserver,
78 public MediaCaptureDevicesDispatcher::Observer {
80 // NOTE: New values need to be appended, since they are used in histograms.
81 enum PrerenderManagerMode {
82 PRERENDER_MODE_DISABLED = 0,
83 PRERENDER_MODE_ENABLED = 1,
84 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP = 2,
85 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP = 3,
86 // Obsolete: PRERENDER_MODE_EXPERIMENT_5MIN_TTL_GROUP = 4,
87 PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP = 5,
88 PRERENDER_MODE_EXPERIMENT_MULTI_PRERENDER_GROUP = 6,
89 PRERENDER_MODE_EXPERIMENT_15MIN_TTL_GROUP = 7,
93 // One or more of these flags must be passed to ClearData() to specify just
94 // what data to clear. See function declaration for more information.
96 CLEAR_PRERENDER_CONTENTS = 0x1 << 0,
97 CLEAR_PRERENDER_HISTORY = 0x1 << 1,
101 typedef predictors::LoggedInPredictorTable::LoggedInStateMap LoggedInStateMap;
103 // ID indicating that no experiment is active.
104 static const uint8 kNoExperiment = 0;
106 // Owned by a Profile object for the lifetime of the profile.
107 PrerenderManager(Profile* profile, PrerenderTracker* prerender_tracker);
109 virtual ~PrerenderManager();
111 // From KeyedService:
112 virtual void Shutdown() OVERRIDE;
114 // Entry points for adding prerenders.
116 // Adds a prerender for |url| if valid. |process_id| and |route_id| identify
117 // the RenderView that the prerender request came from. If |size| is empty, a
118 // default from the PrerenderConfig is used. Returns a caller-owned
119 // PrerenderHandle* if the URL was added, NULL if it was not. If the launching
120 // RenderView is itself prerendering, the prerender is added as a pending
122 PrerenderHandle* AddPrerenderFromLinkRelPrerender(
127 const content::Referrer& referrer,
128 const gfx::Size& size);
130 // Adds a prerender for |url| if valid. As the prerender request is coming
131 // from a source without a RenderViewHost (i.e., the omnibox) we don't have a
132 // child or route id, or a referrer. This method uses sensible values for
133 // those. The |session_storage_namespace| matches the namespace of the active
134 // tab at the time the prerender is generated from the omnibox. Returns a
135 // caller-owned PrerenderHandle*, or NULL.
136 PrerenderHandle* AddPrerenderFromOmnibox(
138 content::SessionStorageNamespace* session_storage_namespace,
139 const gfx::Size& size);
141 PrerenderHandle* AddPrerenderFromLocalPredictor(
143 content::SessionStorageNamespace* session_storage_namespace,
144 const gfx::Size& size);
146 PrerenderHandle* AddPrerenderFromExternalRequest(
148 const content::Referrer& referrer,
149 content::SessionStorageNamespace* session_storage_namespace,
150 const gfx::Size& size);
152 // Adds a prerender for Instant Search |url| if valid. The
153 // |session_storage_namespace| matches the namespace of the active tab at the
154 // time the prerender is generated. Returns a caller-owned PrerenderHandle* or
156 PrerenderHandle* AddPrerenderForInstant(
158 content::SessionStorageNamespace* session_storage_namespace,
159 const gfx::Size& size);
161 // Cancels all active prerenders.
162 void CancelAllPrerenders();
164 // If |url| matches a valid prerendered page and |params| are compatible, try
165 // to swap it and merge browsing histories. Returns |true| and updates
166 // |params->target_contents| if a prerendered page is swapped in, |false|
168 bool MaybeUsePrerenderedPage(const GURL& url,
169 chrome::NavigateParams* params);
171 // Moves a PrerenderContents to the pending delete list from the list of
172 // active prerenders when prerendering should be cancelled.
173 virtual void MoveEntryToPendingDelete(PrerenderContents* entry,
174 FinalStatus final_status);
176 // Records the page load time for a prerender that wasn't swapped in.
177 void RecordPageLoadTimeNotSwappedIn(Origin origin,
178 base::TimeDelta page_load_time,
181 // Records the perceived page load time for a page - effectively the time from
182 // when the user navigates to a page to when it finishes loading. The actual
183 // load may have started prior to navigation due to prerender hints.
184 // This must be called on the UI thread.
185 // |fraction_plt_elapsed_at_swap_in| must either be in [0.0, 1.0], or a value
186 // outside that range indicating that it doesn't apply.
187 void RecordPerceivedPageLoadTime(
189 NavigationType navigation_type,
190 base::TimeDelta perceived_page_load_time,
191 double fraction_plt_elapsed_at_swap_in,
194 // Set whether prerendering is currently enabled for this manager.
195 // Must be called on the UI thread.
196 // If |enabled| is false, existing prerendered pages will still persist until
197 // they time out, but new ones will not be generated.
198 void set_enabled(bool enabled);
200 static PrerenderManagerMode GetMode();
201 static void SetMode(PrerenderManagerMode mode);
202 static const char* GetModeString();
203 static bool IsPrerenderingPossible();
204 static bool ActuallyPrerendering();
205 static bool IsControlGroup(uint8 experiment_id);
206 static bool IsNoUseGroup();
208 // Query the list of current prerender pages to see if the given web contents
209 // is prerendering a page. The optional parameter |origin| is an output
210 // parameter which, if a prerender is found, is set to the Origin of the
211 // prerender |web_contents|.
212 bool IsWebContentsPrerendering(const content::WebContents* web_contents,
213 Origin* origin) const;
215 // Whether the PrerenderManager has an active prerender with the given url and
216 // SessionStorageNamespace associated with the given WebContens.
217 bool HasPrerenderedUrl(GURL url, content::WebContents* web_contents) const;
219 // Returns the PrerenderContents object for the given web_contents, otherwise
220 // returns NULL. Note that the PrerenderContents may have been Destroy()ed,
221 // but not yet deleted.
222 PrerenderContents* GetPrerenderContents(
223 const content::WebContents* web_contents) const;
225 // Returns the PrerenderContents object for a given child_id, route_id pair,
226 // otherwise returns NULL. Note that the PrerenderContents may have been
227 // Destroy()ed, but not yet deleted.
228 virtual PrerenderContents* GetPrerenderContentsForRoute(
229 int child_id, int route_id) const;
231 // Returns a list of all WebContents being prerendered.
232 const std::vector<content::WebContents*> GetAllPrerenderingContents() const;
234 // Checks whether |url| has been recently navigated to.
235 bool HasRecentlyBeenNavigatedTo(Origin origin, const GURL& url);
237 // Returns true iff the method given is valid for prerendering.
238 static bool IsValidHttpMethod(const std::string& method);
240 // Returns true iff the scheme of the URL given is valid for prerendering.
241 static bool DoesURLHaveValidScheme(const GURL& url);
243 // Returns true iff the scheme of the subresource URL given is valid for
245 static bool DoesSubresourceURLHaveValidScheme(const GURL& url);
247 // Returns a Value object containing the active pages being prerendered, and
248 // a history of pages which were prerendered. The caller is responsible for
249 // deleting the return value.
250 base::DictionaryValue* GetAsValue() const;
252 // Clears the data indicated by which bits of clear_flags are set.
254 // If the CLEAR_PRERENDER_CONTENTS bit is set, all active prerenders are
255 // cancelled and then deleted, and any WebContents queued for destruction are
256 // destroyed as well.
258 // If the CLEAR_PRERENDER_HISTORY bit is set, the prerender history is
259 // cleared, including any entries newly created by destroying them in
260 // response to the CLEAR_PRERENDER_CONTENTS flag.
262 // Intended to be used when clearing the cache or history.
263 void ClearData(int clear_flags);
265 // Record a final status of a prerendered page in a histogram.
266 // This variation allows specifying whether prerendering had been started
267 // (necessary to flag MatchComplete dummies).
268 void RecordFinalStatusWithMatchCompleteStatus(
271 PrerenderContents::MatchCompleteStatus mc_status,
272 FinalStatus final_status) const;
274 // Record a cookie status histogram (see prerender_histograms.h).
275 void RecordCookieStatus(Origin origin,
277 int cookie_status) const;
279 // Record a cookie send type histogram (see prerender_histograms.h).
280 void RecordCookieSendType(Origin origin,
282 int cookie_send_type) const;
284 // content::NotificationObserver
285 virtual void Observe(int type,
286 const content::NotificationSource& source,
287 const content::NotificationDetails& details) OVERRIDE;
289 // MediaCaptureDevicesDispatcher::Observer
290 virtual void OnCreatingAudioStream(int render_process_id,
291 int render_frame_id) OVERRIDE;
293 const Config& config() const { return config_; }
294 Config& mutable_config() { return config_; }
296 PrerenderTracker* prerender_tracker() { return prerender_tracker_; }
298 // Adds a condition. This is owned by the PrerenderManager.
299 void AddCondition(const PrerenderCondition* condition);
301 // Records that some visible tab navigated (or was redirected) to the
303 void RecordNavigation(const GURL& url);
305 // Updates the LoggedInPredictor state to reflect that a login has likely
306 // on the URL provided.
307 void RecordLikelyLoginOnURL(const GURL& url);
309 // Checks if the LoggedInPredictor shows that the user is likely logged on
310 // to the site for the URL provided.
311 void CheckIfLikelyLoggedInOnURL(const GURL& url,
313 bool* database_was_present,
314 const base::Closure& result_cb);
316 void OnHistoryServiceDidQueryURL(Origin origin,
318 CancelableRequestProvider::Handle handle,
320 const history::URLRow* url_row,
321 history::VisitVector* visits);
323 Profile* profile() const { return profile_; }
325 // Classes which will be tested in prerender unit browser tests should use
326 // these methods to get times for comparison, so that the test framework can
327 // mock advancing/retarding time.
328 virtual base::Time GetCurrentTime() const;
329 virtual base::TimeTicks GetCurrentTimeTicks() const;
331 scoped_refptr<predictors::LoggedInPredictorTable>
332 logged_in_predictor_table() {
333 return logged_in_predictor_table_;
336 PrerenderLocalPredictor* local_predictor() {
337 return local_predictor_.get();
340 // Notification that a cookie event happened on a render frame. Will record a
341 // cookie event for a given render frame, if it is being prerendered.
342 // If cookies were sent, all cookies must be supplied in |cookie_list|.
343 static void RecordCookieEvent(int process_id,
346 const GURL& frame_url,
347 bool is_for_blocking_resource,
348 PrerenderContents::CookieEvent event,
349 const net::CookieList* cookie_list);
351 // Arranges for all session storage merges to hang indefinitely. This is used
352 // to reliably test various swap abort cases.
353 static void HangSessionStorageMergesForTesting();
355 // Notification that a prerender has completed and its bytes should be
357 void RecordNetworkBytes(bool used, int64 prerender_bytes);
359 // Add to the running tally of bytes transferred over the network for this
360 // profile if prerendering is currently enabled.
361 void AddProfileNetworkBytesIfEnabled(int64 bytes);
365 class PrerenderData : public base::SupportsWeakPtr<PrerenderData> {
367 struct OrderByExpiryTime;
369 PrerenderData(PrerenderManager* manager,
370 PrerenderContents* contents,
371 base::TimeTicks expiry_time);
375 // Turn this PrerenderData into a Match Complete replacement for itself,
376 // placing the current prerender contents into |to_delete_prerenders_|.
377 void MakeIntoMatchCompleteReplacement();
379 // A new PrerenderHandle has been created for this PrerenderData.
380 void OnHandleCreated(PrerenderHandle* prerender_handle);
382 // The launcher associated with a handle is navigating away from the context
383 // that launched this prerender. If the prerender is active, it may stay
384 // alive briefly though, in case we we going through a redirect chain that
385 // will eventually land at it.
386 void OnHandleNavigatedAway(PrerenderHandle* prerender_handle);
388 // The launcher associated with a handle has taken explicit action to cancel
389 // this prerender. We may well destroy the prerender in this case if no
390 // other handles continue to track it.
391 void OnHandleCanceled(PrerenderHandle* prerender_handle);
393 PrerenderContents* contents() { return contents_.get(); }
395 PrerenderContents* ReleaseContents();
397 int handle_count() const { return handle_count_; }
399 base::TimeTicks abandon_time() const { return abandon_time_; }
401 base::TimeTicks expiry_time() const { return expiry_time_; }
402 void set_expiry_time(base::TimeTicks expiry_time) {
403 expiry_time_ = expiry_time;
406 void ClearPendingSwap();
408 PendingSwap* pending_swap() { return pending_swap_.get(); }
409 void set_pending_swap(PendingSwap* pending_swap) {
410 pending_swap_.reset(pending_swap);
414 PrerenderManager* manager_;
415 scoped_ptr<PrerenderContents> contents_;
417 // The number of distinct PrerenderHandles created for |this|, including
418 // ones that have called PrerenderData::OnHandleNavigatedAway(), but not
419 // counting the ones that have called PrerenderData::OnHandleCanceled(). For
420 // pending prerenders, this will always be 1, since the PrerenderManager
421 // only merges handles of running prerenders.
424 // The time when OnHandleNavigatedAway was called.
425 base::TimeTicks abandon_time_;
427 // After this time, this prerender is no longer fresh, and should be
429 base::TimeTicks expiry_time_;
431 // If a session storage namespace merge is in progress for this object,
432 // we need to keep track of various state associated with it.
433 scoped_ptr<PendingSwap> pending_swap_;
435 DISALLOW_COPY_AND_ASSIGN(PrerenderData);
438 // When a swap can't happen immediately, due to a sesison storage namespace
439 // merge, there will be a pending swap object while the merge is in
440 // progress. It retains all the data needed to do the merge, maintains
441 // throttles for the navigation in the target WebContents that needs to be
442 // delayed, and handles all conditions which would cancel a pending swap.
443 class PendingSwap : public content::WebContentsObserver {
445 PendingSwap(PrerenderManager* manager,
446 content::WebContents* target_contents,
447 PrerenderData* prerender_data,
449 bool should_replace_current_entry);
450 virtual ~PendingSwap();
452 content::WebContents* target_contents() const;
453 void set_swap_successful(bool swap_successful) {
454 swap_successful_ = swap_successful;
459 // content::WebContentsObserver implementation.
460 virtual void AboutToNavigateRenderView(
461 content::RenderViewHost* render_view_host) OVERRIDE;
462 virtual void ProvisionalChangeToMainFrameUrl(
464 content::RenderFrameHost* render_frame_host) OVERRIDE;
465 virtual void DidCommitProvisionalLoadForFrame(
467 const base::string16& frame_unique_name,
469 const GURL& validated_url,
470 content::PageTransition transition_type,
471 content::RenderViewHost* render_view_host) OVERRIDE;
472 virtual void DidFailProvisionalLoad(
474 const base::string16& frame_unique_name,
476 const GURL& validated_url,
478 const base::string16& error_description,
479 content::RenderViewHost* render_view_host) OVERRIDE;
480 virtual void WebContentsDestroyed(content::WebContents* web_contents)
484 void RecordEvent(PrerenderEvent event) const;
486 void OnMergeCompleted(content::SessionStorageNamespace::MergeResult result);
487 void OnMergeTimeout();
489 // Prerender parameters.
490 PrerenderManager* manager_;
491 PrerenderData* prerender_data_;
493 bool should_replace_current_entry_;
495 base::TimeTicks start_time_;
496 PrerenderTracker::ChildRouteIdPair target_route_id_;
497 bool seen_target_route_id_;
498 base::OneShotTimer<PendingSwap> merge_timeout_;
499 bool swap_successful_;
501 base::WeakPtrFactory<PendingSwap> weak_factory_;
504 void SetPrerenderContentsFactory(
505 PrerenderContents::Factory* prerender_contents_factory);
507 // Called by a PrerenderData to signal that the launcher has navigated away
508 // from the context that launched the prerender. A user may have clicked
509 // a link in a page containing a <link rel=prerender> element, or the user
510 // might have committed an omnibox navigation. This is used to possibly
511 // shorten the TTL of the prerendered page.
512 void SourceNavigatedAway(PrerenderData* prerender_data);
515 friend class ::InstantSearchPrerendererTest;
516 friend class PrerenderBrowserTest;
517 friend class PrerenderContents;
518 friend class PrerenderHandle;
519 friend class UnitTestPrerenderManager;
521 class OnCloseWebContentsDeleter;
522 struct NavigationRecord;
524 // Time interval before a new prerender is allowed.
525 static const int kMinTimeBetweenPrerendersMs = 500;
527 // Time window for which we record old navigations, in milliseconds.
528 static const int kNavigationRecordWindowMs = 5000;
530 void OnCancelPrerenderHandle(PrerenderData* prerender_data);
532 // Adds a prerender for |url| from |referrer| initiated from the process
533 // |child_id|. The |origin| specifies how the prerender was added. If |size|
534 // is empty, then PrerenderContents::StartPrerendering will instead use a
535 // default from PrerenderConfig. Returns a PrerenderHandle*, owned by the
537 PrerenderHandle* AddPrerender(
541 const content::Referrer& referrer,
542 const gfx::Size& size,
543 content::SessionStorageNamespace* session_storage_namespace);
545 void StartSchedulingPeriodicCleanups();
546 void StopSchedulingPeriodicCleanups();
548 void EvictOldestPrerendersIfNecessary();
550 // Deletes stale and cancelled prerendered PrerenderContents, as well as
551 // WebContents that have been replaced by prerendered WebContents.
552 // Also identifies and kills PrerenderContents that use too much
554 void PeriodicCleanup();
556 // Posts a task to call PeriodicCleanup. Results in quicker destruction of
557 // objects. If |this| is deleted before the task is run, the task will
558 // automatically be cancelled.
559 void PostCleanupTask();
561 base::TimeTicks GetExpiryTimeForNewPrerender(Origin origin) const;
562 base::TimeTicks GetExpiryTimeForNavigatedAwayPrerender() const;
564 void DeleteOldEntries();
565 virtual PrerenderContents* CreatePrerenderContents(
567 const content::Referrer& referrer,
569 uint8 experiment_id);
571 // Insures the |active_prerenders_| are sorted by increasing expiry time. Call
572 // after every mutation of active_prerenders_ that can possibly make it
573 // unsorted (e.g. an insert, or changing an expiry time).
574 void SortActivePrerenders();
576 // Finds the active PrerenderData object for a running prerender matching
577 // |url| and |session_storage_namespace|.
578 PrerenderData* FindPrerenderData(
580 const content::SessionStorageNamespace* session_storage_namespace);
582 // Finds the active PrerenderData object currently in a PendingSwap for
583 // |target_contents|. Otherwise, returns NULL.
584 PrerenderData* FindPrerenderDataForTargetContents(
585 content::WebContents* target_contents);
587 // Given the |prerender_contents|, find the iterator in active_prerenders_
588 // correponding to the given prerender.
589 ScopedVector<PrerenderData>::iterator
590 FindIteratorForPrerenderContents(PrerenderContents* prerender_contents);
592 bool DoesRateLimitAllowPrerender(Origin origin) const;
594 // Deletes old WebContents that have been replaced by prerendered ones. This
595 // is needed because they're replaced in a callback from the old WebContents,
596 // so cannot immediately be deleted.
597 void DeleteOldWebContents();
599 // Cleans up old NavigationRecord's.
600 void CleanUpOldNavigations();
602 // Arrange for the given WebContents to be deleted asap. If deleter is not
603 // NULL, deletes that as well.
604 void ScheduleDeleteOldWebContents(content::WebContents* tab,
605 OnCloseWebContentsDeleter* deleter);
607 // Adds to the history list.
608 void AddToHistory(PrerenderContents* contents);
610 // Returns a new Value representing the pages currently being prerendered. The
611 // caller is responsible for delete'ing the return value.
612 base::Value* GetActivePrerendersAsValue() const;
614 // Destroys all pending prerenders using FinalStatus. Also deletes them as
615 // well as any swapped out WebContents queued for destruction.
616 // Used both on destruction, and when clearing the browsing history.
617 void DestroyAllContents(FinalStatus final_status);
619 // Helper function to destroy a PrerenderContents with the specified
620 // final_status, while at the same time recording that for the MatchComplete
621 // case, that this prerender would have been used.
622 void DestroyAndMarkMatchCompleteAsUsed(PrerenderContents* prerender_contents,
623 FinalStatus final_status);
625 // Record a final status of a prerendered page in a histogram.
626 // This is a helper function which will ultimately call
627 // RecordFinalStatusWthMatchCompleteStatus, using MATCH_COMPLETE_DEFAULT.
628 void RecordFinalStatus(Origin origin,
630 FinalStatus final_status) const;
632 // Returns whether prerendering is currently enabled for this manager.
633 // Must be called on the UI thread.
634 bool IsEnabled() const;
636 void CookieChanged(ChromeCookieDetails* details);
637 void CookieChangedAnyCookiesLeftLookupResult(const std::string& domain_key,
639 void LoggedInPredictorDataReceived(scoped_ptr<LoggedInStateMap> new_map);
641 void RecordEvent(PrerenderContents* contents, PrerenderEvent event) const;
643 // Swaps a prerender |prerender_data| for |url| into the tab, replacing
644 // |web_contents|. Returns the new WebContents that was swapped in, or NULL
645 // if a swap-in was not possible. If |should_replace_current_entry| is true,
646 // the current history entry in |web_contents| is replaced.
647 content::WebContents* SwapInternal(const GURL& url,
648 content::WebContents* web_contents,
649 PrerenderData* prerender_data,
650 bool should_replace_current_entry);
652 // The configuration.
655 // Specifies whether prerendering is currently enabled for this
656 // manager. The value can change dynamically during the lifetime
657 // of the PrerenderManager.
660 // The profile that owns this PrerenderManager.
663 PrerenderTracker* prerender_tracker_;
665 // All running prerenders. Sorted by expiry time, in ascending order.
666 ScopedVector<PrerenderData> active_prerenders_;
668 // Prerenders awaiting deletion.
669 ScopedVector<PrerenderData> to_delete_prerenders_;
671 // List of recent navigations in this profile, sorted by ascending
673 std::list<NavigationRecord> navigations_;
675 scoped_ptr<PrerenderContents::Factory> prerender_contents_factory_;
677 static PrerenderManagerMode mode_;
679 // A count of how many prerenders we do per session. Initialized to 0 then
680 // incremented and emitted to a histogram on each successful prerender.
681 static int prerenders_per_session_count_;
683 // RepeatingTimer to perform periodic cleanups of pending prerendered
685 base::RepeatingTimer<PrerenderManager> repeating_timer_;
687 // Track time of last prerender to limit prerender spam.
688 base::TimeTicks last_prerender_start_time_;
690 std::list<content::WebContents*> old_web_contents_list_;
692 ScopedVector<OnCloseWebContentsDeleter> on_close_web_contents_deleters_;
694 scoped_ptr<PrerenderHistory> prerender_history_;
696 std::list<const PrerenderCondition*> prerender_conditions_;
698 scoped_ptr<PrerenderHistograms> histograms_;
700 scoped_ptr<PrerenderLocalPredictor> local_predictor_;
702 scoped_refptr<predictors::LoggedInPredictorTable> logged_in_predictor_table_;
704 // Here, we keep the logged in predictor state, but potentially a superset
705 // of its actual (database-backed) state, since we do not incorporate
706 // browser data deletion. We do not use this for actual lookups, but only
707 // to query cookie data for domains we know there was a login before.
708 // This is required to avoid a large number of cookie lookups on bulk
709 // deletion of cookies.
710 scoped_ptr<LoggedInStateMap> logged_in_state_;
712 content::NotificationRegistrar notification_registrar_;
714 CancelableRequestConsumer query_url_consumer_;
716 // The number of bytes transferred over the network for the profile this
717 // PrerenderManager is attached to.
718 int64 profile_network_bytes_;
720 // The value of profile_network_bytes_ that was last recorded.
721 int64 last_recorded_profile_network_bytes_;
723 DISALLOW_COPY_AND_ASSIGN(PrerenderManager);
726 } // namespace prerender
728 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_