prerender_manager.h revision ca12bfac764ba476d6cd062bf1dde12cc64c3f40
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. 4 5#ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ 6#define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ 7 8#include <list> 9#include <map> 10#include <string> 11#include <utility> 12#include <vector> 13 14#include "base/containers/hash_tables.h" 15#include "base/gtest_prod_util.h" 16#include "base/memory/scoped_ptr.h" 17#include "base/memory/scoped_vector.h" 18#include "base/memory/weak_ptr.h" 19#include "base/threading/non_thread_safe.h" 20#include "base/time/time.h" 21#include "base/timer/timer.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_final_status.h" 27#include "chrome/browser/prerender/prerender_origin.h" 28#include "components/browser_context_keyed_service/browser_context_keyed_service.h" 29#include "content/public/browser/notification_observer.h" 30#include "content/public/browser/notification_registrar.h" 31#include "net/cookies/cookie_monster.h" 32#include "url/gurl.h" 33 34class Profile; 35struct ChromeCookieDetails; 36 37namespace base { 38class DictionaryValue; 39} 40 41namespace content { 42class WebContents; 43} 44 45namespace gfx { 46class Size; 47} 48 49namespace net { 50class URLRequestContextGetter; 51} 52 53#if defined(COMPILER_GCC) 54 55namespace BASE_HASH_NAMESPACE { 56template <> 57struct hash<content::WebContents*> { 58 std::size_t operator()(content::WebContents* value) const { 59 return reinterpret_cast<std::size_t>(value); 60 } 61}; 62 63} // namespace BASE_HASH_NAMESPACE 64 65#endif 66 67namespace prerender { 68 69class PrerenderCondition; 70class PrerenderHandle; 71class PrerenderHistograms; 72class PrerenderHistory; 73class PrerenderLocalPredictor; 74class PrerenderTracker; 75 76// PrerenderManager is responsible for initiating and keeping prerendered 77// views of web pages. All methods must be called on the UI thread unless 78// indicated otherwise. 79class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, 80 public base::NonThreadSafe, 81 public content::NotificationObserver, 82 public BrowserContextKeyedService, 83 public MediaCaptureDevicesDispatcher::Observer { 84 public: 85 // NOTE: New values need to be appended, since they are used in histograms. 86 enum PrerenderManagerMode { 87 PRERENDER_MODE_DISABLED = 0, 88 PRERENDER_MODE_ENABLED = 1, 89 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP = 2, 90 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP = 3, 91 // Obsolete: PRERENDER_MODE_EXPERIMENT_5MIN_TTL_GROUP = 4, 92 PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP = 5, 93 PRERENDER_MODE_EXPERIMENT_MULTI_PRERENDER_GROUP = 6, 94 PRERENDER_MODE_EXPERIMENT_15MIN_TTL_GROUP = 7, 95 PRERENDER_MODE_MAX 96 }; 97 98 // 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. 100 enum ClearFlags { 101 CLEAR_PRERENDER_CONTENTS = 0x1 << 0, 102 CLEAR_PRERENDER_HISTORY = 0x1 << 1, 103 CLEAR_MAX = 0x1 << 2 104 }; 105 106 typedef predictors::LoggedInPredictorTable::LoggedInStateMap LoggedInStateMap; 107 108 // ID indicating that no experiment is active. 109 static const uint8 kNoExperiment = 0; 110 111 // Owned by a Profile object for the lifetime of the profile. 112 PrerenderManager(Profile* profile, PrerenderTracker* prerender_tracker); 113 114 virtual ~PrerenderManager(); 115 116 // From BrowserContextKeyedService: 117 virtual void Shutdown() OVERRIDE; 118 119 // Entry points for adding prerenders. 120 121 // Adds a prerender for |url| if valid. |process_id| and |route_id| identify 122 // the RenderView that the prerender request came from. If |size| is empty, a 123 // default from the PrerenderConfig is used. Returns a caller-owned 124 // PrerenderHandle* if the URL was added, NULL if it was not. If the launching 125 // RenderView is itself prerendering, the prerender is added as a pending 126 // prerender. 127 PrerenderHandle* AddPrerenderFromLinkRelPrerender( 128 int process_id, 129 int route_id, 130 const GURL& url, 131 const content::Referrer& referrer, 132 const gfx::Size& size); 133 134 // Adds a prerender for |url| if valid. As the prerender request is coming 135 // from a source without a RenderViewHost (i.e., the omnibox) we don't have a 136 // child or route id, or a referrer. This method uses sensible values for 137 // those. The |session_storage_namespace| matches the namespace of the active 138 // tab at the time the prerender is generated from the omnibox. Returns a 139 // caller-owned PrerenderHandle*, or NULL. 140 PrerenderHandle* AddPrerenderFromOmnibox( 141 const GURL& url, 142 content::SessionStorageNamespace* session_storage_namespace, 143 const gfx::Size& size); 144 145 PrerenderHandle* AddPrerenderFromLocalPredictor( 146 const GURL& url, 147 content::SessionStorageNamespace* session_storage_namespace, 148 const gfx::Size& size); 149 150 // If |process_id| and |view_id| refer to a running prerender, destroy 151 // it with |final_status|. 152 virtual void DestroyPrerenderForRenderView(int process_id, 153 int view_id, 154 FinalStatus final_status); 155 156 // Cancels all active prerenders. 157 void CancelAllPrerenders(); 158 159 // If |url| matches a valid prerendered page, try to swap it into 160 // |web_contents| and merge browsing histories. Returns |true| if a 161 // prerendered page is swapped in, |false| otherwise. 162 bool MaybeUsePrerenderedPage(content::WebContents* web_contents, 163 const GURL& url); 164 165 // Moves a PrerenderContents to the pending delete list from the list of 166 // active prerenders when prerendering should be cancelled. 167 virtual void MoveEntryToPendingDelete(PrerenderContents* entry, 168 FinalStatus final_status); 169 170 // Records the perceived page load time for a page - effectively the time from 171 // when the user navigates to a page to when it finishes loading. The actual 172 // load may have started prior to navigation due to prerender hints. 173 // This must be called on the UI thread. 174 // |fraction_plt_elapsed_at_swap_in| must either be in [0.0, 1.0], or a value 175 // outside that range indicating that it doesn't apply. 176 static void RecordPerceivedPageLoadTime( 177 base::TimeDelta perceived_page_load_time, 178 double fraction_plt_elapsed_at_swap_in, 179 content::WebContents* web_contents, 180 const GURL& url); 181 182 // Records the percentage of pixels of the final page in place at swap-in. 183 void RecordFractionPixelsFinalAtSwapin( 184 content::WebContents* web_contents, 185 double fraction); 186 187 // Set whether prerendering is currently enabled for this manager. 188 // Must be called on the UI thread. 189 // If |enabled| is false, existing prerendered pages will still persist until 190 // they time out, but new ones will not be generated. 191 void set_enabled(bool enabled); 192 193 // Controls if we launch or squash prefetch requests as they arrive from 194 // renderers. 195 static bool IsPrefetchEnabled(); 196 static void SetIsPrefetchEnabled(bool enabled); 197 198 static PrerenderManagerMode GetMode(); 199 static void SetMode(PrerenderManagerMode mode); 200 static const char* GetModeString(); 201 static bool IsPrerenderingPossible(); 202 static bool ActuallyPrerendering(); 203 static bool IsControlGroup(uint8 experiment_id); 204 static bool IsNoUseGroup(); 205 206 // Query the list of current prerender pages to see if the given web contents 207 // is prerendering a page. The optional parameter |origin| is an output 208 // parameter which, if a prerender is found, is set to the Origin of the 209 // prerender |web_contents|. 210 bool IsWebContentsPrerendering(const content::WebContents* web_contents, 211 Origin* origin) const; 212 213 // Returns the PrerenderContents object for the given web_contents if it's 214 // used for an active prerender page, otherwise returns NULL. 215 PrerenderContents* GetPrerenderContents( 216 const content::WebContents* web_contents) const; 217 218 // Returns a list of all WebContents being prerendered. 219 const std::vector<content::WebContents*> GetAllPrerenderingContents() const; 220 221 // Maintaining and querying the set of WebContents belonging to this 222 // PrerenderManager that are currently showing prerendered pages. 223 void MarkWebContentsAsPrerendered(content::WebContents* web_contents, 224 Origin origin); 225 void MarkWebContentsAsWouldBePrerendered(content::WebContents* web_contents, 226 Origin origin); 227 void MarkWebContentsAsNotPrerendered(content::WebContents* web_contents); 228 229 // Returns true if |web_contents| was originally a prerender that has since 230 // been swapped in. The optional parameter |origin| is an output parameter 231 // which, if a prerender is found, is set to the Origin of the prerender of 232 // |web_contents|. 233 bool IsWebContentsPrerendered(content::WebContents* web_contents, 234 Origin* origin) const; 235 bool WouldWebContentsBePrerendered(content::WebContents* web_contents, 236 Origin* origin) const; 237 238 // Checks whether |url| has been recently navigated to. 239 bool HasRecentlyBeenNavigatedTo(Origin origin, const GURL& url); 240 241 // Returns true iff the method given is valid for prerendering. 242 static bool IsValidHttpMethod(const std::string& method); 243 244 // Returns true iff the scheme of the URL given is valid for prerendering. 245 static bool DoesURLHaveValidScheme(const GURL& url); 246 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; 251 252 // Clears the data indicated by which bits of clear_flags are set. 253 // 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. 257 // 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. 261 // 262 // Intended to be used when clearing the cache or history. 263 void ClearData(int clear_flags); 264 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( 269 Origin origin, 270 uint8 experiment_id, 271 PrerenderContents::MatchCompleteStatus mc_status, 272 FinalStatus final_status) const; 273 274 // content::NotificationObserver 275 virtual void Observe(int type, 276 const content::NotificationSource& source, 277 const content::NotificationDetails& details) OVERRIDE; 278 279 // MediaCaptureDevicesDispatcher::Observer 280 virtual void OnCreatingAudioStream(int render_process_id, 281 int render_view_id) OVERRIDE; 282 283 const Config& config() const { return config_; } 284 Config& mutable_config() { return config_; } 285 286 PrerenderTracker* prerender_tracker() { return prerender_tracker_; } 287 288 // Adds a condition. This is owned by the PrerenderManager. 289 void AddCondition(const PrerenderCondition* condition); 290 291 // Records that some visible tab navigated (or was redirected) to the 292 // provided URL. 293 void RecordNavigation(const GURL& url); 294 295 // Updates the LoggedInPredictor state to reflect that a login has likely 296 // on the URL provided. 297 void RecordLikelyLoginOnURL(const GURL& url); 298 299 // Checks if the LoggedInPredictor shows that the user is likely logged on 300 // to the site for the URL provided. 301 void CheckIfLikelyLoggedInOnURL(const GURL& url, 302 bool* lookup_result, 303 bool* database_was_present, 304 const base::Closure& result_cb); 305 306 Profile* profile() const { return profile_; } 307 308 // Classes which will be tested in prerender unit browser tests should use 309 // these methods to get times for comparison, so that the test framework can 310 // mock advancing/retarding time. 311 virtual base::Time GetCurrentTime() const; 312 virtual base::TimeTicks GetCurrentTimeTicks() const; 313 314 scoped_refptr<predictors::LoggedInPredictorTable> 315 logged_in_predictor_table() { 316 return logged_in_predictor_table_; 317 } 318 319 PrerenderLocalPredictor* local_predictor() { 320 return local_predictor_.get(); 321 } 322 323 protected: 324 class PrerenderData : public base::SupportsWeakPtr<PrerenderData> { 325 public: 326 struct OrderByExpiryTime; 327 328 PrerenderData(PrerenderManager* manager, 329 PrerenderContents* contents, 330 base::TimeTicks expiry_time); 331 332 ~PrerenderData(); 333 334 // Turn this PrerenderData into a Match Complete replacement for itself, 335 // placing the current prerender contents into |to_delete_prerenders_|. 336 void MakeIntoMatchCompleteReplacement(); 337 338 // A new PrerenderHandle has been created for this PrerenderData. 339 void OnHandleCreated(PrerenderHandle* prerender_handle); 340 341 // The launcher associated with a handle is navigating away from the context 342 // that launched this prerender. If the prerender is active, it may stay 343 // alive briefly though, in case we we going through a redirect chain that 344 // will eventually land at it. 345 void OnHandleNavigatedAway(PrerenderHandle* prerender_handle); 346 347 // The launcher associated with a handle has taken explicit action to cancel 348 // this prerender. We may well destroy the prerender in this case if no 349 // other handles continue to track it. 350 void OnHandleCanceled(PrerenderHandle* prerender_handle); 351 352 PrerenderContents* contents() { return contents_.get(); } 353 354 PrerenderContents* ReleaseContents(); 355 356 int handle_count() const { return handle_count_; } 357 358 base::TimeTicks expiry_time() const { return expiry_time_; } 359 void set_expiry_time(base::TimeTicks expiry_time) { 360 expiry_time_ = expiry_time; 361 } 362 363 private: 364 PrerenderManager* manager_; 365 scoped_ptr<PrerenderContents> contents_; 366 367 // The number of distinct PrerenderHandles created for |this|, including 368 // ones that have called PrerenderData::OnHandleNavigatedAway(), but not 369 // counting the ones that have called PrerenderData::OnHandleCanceled(). For 370 // pending prerenders, this will always be 1, since the PrerenderManager 371 // only merges handles of running prerenders. 372 int handle_count_; 373 374 // After this time, this prerender is no longer fresh, and should be 375 // removed. 376 base::TimeTicks expiry_time_; 377 378 DISALLOW_COPY_AND_ASSIGN(PrerenderData); 379 }; 380 381 void SetPrerenderContentsFactory( 382 PrerenderContents::Factory* prerender_contents_factory); 383 384 // Adds prerenders from the pending Prerenders, called by 385 // PrerenderContents::StartPendingPrerenders. 386 void StartPendingPrerenders( 387 int process_id, 388 ScopedVector<PrerenderContents::PendingPrerenderInfo>* pending_prerenders, 389 content::SessionStorageNamespace* session_storage_namespace); 390 391 // Called by a PrerenderData to signal that the launcher has navigated away 392 // from the context that launched the prerender. A user may have clicked 393 // a link in a page containing a <link rel=prerender> element, or the user 394 // might have committed an omnibox navigation. This is used to possibly 395 // shorten the TTL of the prerendered page. 396 void SourceNavigatedAway(PrerenderData* prerender_data); 397 398 private: 399 friend class PrerenderBrowserTest; 400 friend class PrerenderContents; 401 friend class PrerenderHandle; 402 friend class UnitTestPrerenderManager; 403 404 class OnCloseWebContentsDeleter; 405 struct NavigationRecord; 406 407 // For each WebContents that is swapped in, we store a 408 // PrerenderedWebContentsData so that we can track the origin of the 409 // prerender. 410 struct PrerenderedWebContentsData { 411 explicit PrerenderedWebContentsData(Origin origin); 412 413 Origin origin; 414 }; 415 416 // In the control group experimental group for each WebContents "not swapped 417 // in" we create a WouldBePrerenderedWebContentsData to the origin of the 418 // "prerender" we did not launch. We also track a state machine to ensure 419 // the histogram reporting tracks what histograms would have done. 420 struct WouldBePrerenderedWebContentsData { 421 // When the WebContents gets a provisional load, we'd like to remove the 422 // WebContents from the map since the new navigation would not have swapped 423 // in a prerender. But the first provisional load after the control 424 // prerender is not "swapped in" is actually to the prerendered location! So 425 // we don't remove the item from the map on the first provisional load, but 426 // we do for subsequent loads. 427 enum State { 428 WAITING_FOR_PROVISIONAL_LOAD, 429 SEEN_PROVISIONAL_LOAD, 430 }; 431 432 explicit WouldBePrerenderedWebContentsData(Origin origin); 433 434 Origin origin; 435 State state; 436 }; 437 438 // Time interval before a new prerender is allowed. 439 static const int kMinTimeBetweenPrerendersMs = 500; 440 441 // Time window for which we record old navigations, in milliseconds. 442 static const int kNavigationRecordWindowMs = 5000; 443 444 void OnCancelPrerenderHandle(PrerenderData* prerender_data); 445 446 // Adds a prerender for |url| from |referrer| initiated from the process 447 // |child_id|. The |origin| specifies how the prerender was added. If |size| 448 // is empty, then PrerenderContents::StartPrerendering will instead use a 449 // default from PrerenderConfig. Returns a PrerenderHandle*, owned by the 450 // caller, or NULL. 451 PrerenderHandle* AddPrerender( 452 Origin origin, 453 int child_id, 454 const GURL& url, 455 const content::Referrer& referrer, 456 const gfx::Size& size, 457 content::SessionStorageNamespace* session_storage_namespace); 458 459 void StartSchedulingPeriodicCleanups(); 460 void StopSchedulingPeriodicCleanups(); 461 462 void EvictOldestPrerendersIfNecessary(); 463 464 // Deletes stale and cancelled prerendered PrerenderContents, as well as 465 // WebContents that have been replaced by prerendered WebContents. 466 // Also identifies and kills PrerenderContents that use too much 467 // resources. 468 void PeriodicCleanup(); 469 470 // Posts a task to call PeriodicCleanup. Results in quicker destruction of 471 // objects. If |this| is deleted before the task is run, the task will 472 // automatically be cancelled. 473 void PostCleanupTask(); 474 475 base::TimeTicks GetExpiryTimeForNewPrerender(Origin origin) const; 476 base::TimeTicks GetExpiryTimeForNavigatedAwayPrerender() const; 477 478 void DeleteOldEntries(); 479 virtual PrerenderContents* CreatePrerenderContents( 480 const GURL& url, 481 const content::Referrer& referrer, 482 Origin origin, 483 uint8 experiment_id); 484 485 // Insures the |active_prerenders_| are sorted by increasing expiry time. Call 486 // after every mutation of active_prerenders_ that can possibly make it 487 // unsorted (e.g. an insert, or changing an expiry time). 488 void SortActivePrerenders(); 489 490 // Finds the active PrerenderData object for a running prerender matching 491 // |url| and |session_storage_namespace|. 492 PrerenderData* FindPrerenderData( 493 const GURL& url, 494 const content::SessionStorageNamespace* session_storage_namespace); 495 496 // If |child_id| and |route_id| correspond to a RenderView that is an active 497 // prerender, returns the PrerenderData object for that prerender. Otherwise, 498 // returns NULL. 499 PrerenderData* FindPrerenderDataForChildAndRoute(int child_id, int route_id); 500 501 // Given the |prerender_contents|, find the iterator in active_prerenders_ 502 // correponding to the given prerender. 503 ScopedVector<PrerenderData>::iterator 504 FindIteratorForPrerenderContents(PrerenderContents* prerender_contents); 505 506 bool DoesRateLimitAllowPrerender(Origin origin) const; 507 508 // Deletes old WebContents that have been replaced by prerendered ones. This 509 // is needed because they're replaced in a callback from the old WebContents, 510 // so cannot immediately be deleted. 511 void DeleteOldWebContents(); 512 513 // Cleans up old NavigationRecord's. 514 void CleanUpOldNavigations(); 515 516 // Arrange for the given WebContents to be deleted asap. If deleter is not 517 // NULL, deletes that as well. 518 void ScheduleDeleteOldWebContents(content::WebContents* tab, 519 OnCloseWebContentsDeleter* deleter); 520 521 // Adds to the history list. 522 void AddToHistory(PrerenderContents* contents); 523 524 // Returns a new Value representing the pages currently being prerendered. The 525 // caller is responsible for delete'ing the return value. 526 base::Value* GetActivePrerendersAsValue() const; 527 528 // Destroys all pending prerenders using FinalStatus. Also deletes them as 529 // well as any swapped out WebContents queued for destruction. 530 // Used both on destruction, and when clearing the browsing history. 531 void DestroyAllContents(FinalStatus final_status); 532 533 // Helper function to destroy a PrerenderContents with the specified 534 // final_status, while at the same time recording that for the MatchComplete 535 // case, that this prerender would have been used. 536 void DestroyAndMarkMatchCompleteAsUsed(PrerenderContents* prerender_contents, 537 FinalStatus final_status); 538 539 // Record a final status of a prerendered page in a histogram. 540 // This is a helper function which will ultimately call 541 // RecordFinalStatusWthMatchCompleteStatus, using MATCH_COMPLETE_DEFAULT. 542 void RecordFinalStatus(Origin origin, 543 uint8 experiment_id, 544 FinalStatus final_status) const; 545 546 // Returns whether prerendering is currently enabled for this manager. 547 // Must be called on the UI thread. 548 bool IsEnabled() const; 549 550 void CookieChanged(ChromeCookieDetails* details); 551 void CookieChangedAnyCookiesLeftLookupResult(const std::string& domain_key, 552 bool cookies_exist); 553 void LoggedInPredictorDataReceived(scoped_ptr<LoggedInStateMap> new_map); 554 555 // The configuration. 556 Config config_; 557 558 // Specifies whether prerendering is currently enabled for this 559 // manager. The value can change dynamically during the lifetime 560 // of the PrerenderManager. 561 bool enabled_; 562 563 static bool is_prefetch_enabled_; 564 565 // The profile that owns this PrerenderManager. 566 Profile* profile_; 567 568 PrerenderTracker* prerender_tracker_; 569 570 // All running prerenders. Sorted by expiry time, in ascending order. 571 ScopedVector<PrerenderData> active_prerenders_; 572 573 // Prerenders awaiting deletion. 574 ScopedVector<PrerenderData> to_delete_prerenders_; 575 576 // List of recent navigations in this profile, sorted by ascending 577 // navigate_time_. 578 std::list<NavigationRecord> navigations_; 579 580 // This map is from all WebContents which are currently displaying a 581 // prerendered page which has already been swapped in to a 582 // PrerenderedWebContentsData for tracking full lifetime information 583 // on prerenders. 584 base::hash_map<content::WebContents*, PrerenderedWebContentsData> 585 prerendered_web_contents_data_; 586 587 // WebContents that would have been swapped out for a prerendered WebContents 588 // if the user was not part of the control group for measurement. When the 589 // WebContents gets a provisional load, the WebContents is removed from 590 // the map since the new navigation would not have swapped in a prerender. 591 // However, one complication exists because the first provisional load after 592 // the WebContents is marked as "Would Have Been Prerendered" is actually to 593 // the prerendered location. So, we need to keep a state around that does 594 // not clear the item from the map on the first provisional load, but does 595 // for subsequent loads. 596 base::hash_map<content::WebContents*, WouldBePrerenderedWebContentsData> 597 would_be_prerendered_map_; 598 599 scoped_ptr<PrerenderContents::Factory> prerender_contents_factory_; 600 601 static PrerenderManagerMode mode_; 602 603 // A count of how many prerenders we do per session. Initialized to 0 then 604 // incremented and emitted to a histogram on each successful prerender. 605 static int prerenders_per_session_count_; 606 607 // RepeatingTimer to perform periodic cleanups of pending prerendered 608 // pages. 609 base::RepeatingTimer<PrerenderManager> repeating_timer_; 610 611 // Track time of last prerender to limit prerender spam. 612 base::TimeTicks last_prerender_start_time_; 613 614 std::list<content::WebContents*> old_web_contents_list_; 615 616 ScopedVector<OnCloseWebContentsDeleter> on_close_web_contents_deleters_; 617 618 scoped_ptr<PrerenderHistory> prerender_history_; 619 620 std::list<const PrerenderCondition*> prerender_conditions_; 621 622 scoped_ptr<PrerenderHistograms> histograms_; 623 624 scoped_ptr<PrerenderLocalPredictor> local_predictor_; 625 626 scoped_refptr<predictors::LoggedInPredictorTable> logged_in_predictor_table_; 627 628 // Here, we keep the logged in predictor state, but potentially a superset 629 // of its actual (database-backed) state, since we do not incorporate 630 // browser data deletion. We do not use this for actual lookups, but only 631 // to query cookie data for domains we know there was a login before. 632 // This is required to avoid a large number of cookie lookups on bulk 633 // deletion of cookies. 634 scoped_ptr<LoggedInStateMap> logged_in_state_; 635 636 content::NotificationRegistrar notification_registrar_; 637 638 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); 639}; 640 641PrerenderManager* FindPrerenderManagerUsingRenderProcessId( 642 int render_process_id); 643 644} // namespace prerender 645 646#endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ 647