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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | |
10 #include <string> | 11 #include <string> |
11 #include <utility> | 12 #include <utility> |
12 | 13 |
13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
14 #include "base/hash_tables.h" | 15 #include "base/hash_tables.h" |
15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
18 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
19 #include "base/time.h" | 20 #include "base/time.h" |
20 #include "base/timer.h" | 21 #include "base/timer.h" |
21 #include "chrome/browser/prerender/prerender_config.h" | 22 #include "chrome/browser/prerender/prerender_config.h" |
22 #include "chrome/browser/prerender/prerender_contents.h" | 23 #include "chrome/browser/prerender/prerender_contents.h" |
23 #include "chrome/browser/prerender/prerender_final_status.h" | 24 #include "chrome/browser/prerender/prerender_final_status.h" |
25 #include "chrome/browser/prerender/prerender_handle.h" | |
24 #include "chrome/browser/prerender/prerender_origin.h" | 26 #include "chrome/browser/prerender/prerender_origin.h" |
25 #include "chrome/browser/profiles/profile_keyed_service.h" | 27 #include "chrome/browser/profiles/profile_keyed_service.h" |
26 #include "googleurl/src/gurl.h" | 28 #include "googleurl/src/gurl.h" |
27 | 29 |
28 class Profile; | 30 class Profile; |
29 | 31 |
30 namespace base { | 32 namespace base { |
31 class DictionaryValue; | 33 class DictionaryValue; |
32 } | 34 } |
33 | 35 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 virtual void Shutdown() OVERRIDE; | 101 virtual void Shutdown() OVERRIDE; |
100 | 102 |
101 // Entry points for adding prerenders. | 103 // Entry points for adding prerenders. |
102 | 104 |
103 // Adds a prerender for |url| if valid. |process_id| and |route_id| identify | 105 // Adds a prerender for |url| if valid. |process_id| and |route_id| identify |
104 // the RenderView that the prerender request came from. The |size| may be | 106 // the RenderView that the prerender request came from. The |size| may be |
105 // empty, and the current tab size will be used if it is. If the current | 107 // empty, and the current tab size will be used if it is. If the current |
106 // active tab size cannot be found, we use a default from PrerenderConfig. | 108 // active tab size cannot be found, we use a default from PrerenderConfig. |
107 // Returns true if the URL was added, false if it was not. | 109 // Returns true if the URL was added, false if it was not. |
108 // If the launching RenderView is itself prerendering, the prerender is added | 110 // If the launching RenderView is itself prerendering, the prerender is added |
109 // as a pending prerender. | 111 // as a pending prerender. |
dominich
2012/07/02 20:43:03
Add comment that caller is the owner of the return
gavinp
2012/07/03 16:41:02
Done.
| |
110 bool AddPrerenderFromLinkRelPrerender( | 112 PrerenderHandle* AddPrerenderFromLinkRelPrerender( |
111 int process_id, | 113 int process_id, |
112 int route_id, | 114 int route_id, |
113 const GURL& url, | 115 const GURL& url, |
114 const content::Referrer& referrer, | 116 const content::Referrer& referrer, |
115 gfx::Size size); | 117 gfx::Size size); |
116 | 118 |
117 // Adds a prerender for |url| if valid. As the prerender request is coming | 119 // Adds a prerender for |url| if valid. As the prerender request is coming |
118 // from a source without a RenderViewHost (i.e., the omnibox) we don't have a | 120 // from a source without a RenderViewHost (i.e., the omnibox) we don't have a |
119 // child or route id, or a referrer. This method uses sensible values for | 121 // child or route id, or a referrer. This method uses sensible values for |
120 // those. The |session_storage_namespace| matches the namespace of the active | 122 // those. The |session_storage_namespace| matches the namespace of the active |
121 // tab at the time the prerender is generated from the omnibox. | 123 // tab at the time the prerender is generated from the omnibox. |
122 bool AddPrerenderFromOmnibox( | 124 PrerenderHandle* AddPrerenderFromOmnibox( |
123 const GURL& url, | 125 const GURL& url, |
124 content::SessionStorageNamespace* session_storage_namespace, | 126 content::SessionStorageNamespace* session_storage_namespace, |
125 gfx::Size size); | 127 gfx::Size size); |
126 | 128 |
127 // Request cancelation of a previously added prerender. If the |active_count_| | |
128 // of the prerender is one, it will be canceled. Otherwise, |active_count_| | |
129 // will be decremented by one. | |
130 void MaybeCancelPrerender(const GURL& url); | |
131 | |
132 // Destroy all prerenders for the given child route id pair and assign a final | 129 // Destroy all prerenders for the given child route id pair and assign a final |
133 // status to them. | 130 // status to them. |
134 virtual void DestroyPrerenderForRenderView(int process_id, | 131 virtual void DestroyPrerenderForRenderView(int process_id, |
135 int view_id, | 132 int view_id, |
136 FinalStatus final_status); | 133 FinalStatus final_status); |
137 | 134 |
138 // Cancels all active prerenders. | 135 // Cancels all active prerenders. |
139 void CancelAllPrerenders(); | 136 void CancelAllPrerenders(); |
140 | 137 |
141 // If |url| matches a valid prerendered page, try to swap it into | 138 // If |url| matches a valid prerendered page, try to swap it into |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 static const char* GetModeString(); | 174 static const char* GetModeString(); |
178 static bool IsPrerenderingPossible(); | 175 static bool IsPrerenderingPossible(); |
179 static bool ActuallyPrerendering(); | 176 static bool ActuallyPrerendering(); |
180 static bool IsControlGroup(); | 177 static bool IsControlGroup(); |
181 static bool IsNoUseGroup(); | 178 static bool IsNoUseGroup(); |
182 | 179 |
183 // Query the list of current prerender pages to see if the given web contents | 180 // Query the list of current prerender pages to see if the given web contents |
184 // is prerendering a page. | 181 // is prerendering a page. |
185 bool IsWebContentsPrerendering(content::WebContents* web_contents) const; | 182 bool IsWebContentsPrerendering(content::WebContents* web_contents) const; |
186 | 183 |
187 // Returns true if there is a prerendered page for the given URL and it has | |
188 // finished loading. Only valid if called before MaybeUsePrerenderedPage. | |
189 bool DidPrerenderFinishLoading(const GURL& url) const; | |
190 | |
191 // Maintaining and querying the set of WebContents belonging to this | 184 // Maintaining and querying the set of WebContents belonging to this |
192 // PrerenderManager that are currently showing prerendered pages. | 185 // PrerenderManager that are currently showing prerendered pages. |
193 void MarkWebContentsAsPrerendered(content::WebContents* web_contents); | 186 void MarkWebContentsAsPrerendered(content::WebContents* web_contents); |
194 void MarkWebContentsAsWouldBePrerendered(content::WebContents* web_contents); | 187 void MarkWebContentsAsWouldBePrerendered(content::WebContents* web_contents); |
195 void MarkWebContentsAsNotPrerendered(content::WebContents* web_contents); | 188 void MarkWebContentsAsNotPrerendered(content::WebContents* web_contents); |
196 bool IsWebContentsPrerendered(content::WebContents* web_contents) const; | 189 bool IsWebContentsPrerendered(content::WebContents* web_contents) const; |
197 bool WouldWebContentsBePrerendered(content::WebContents* web_contents) const; | 190 bool WouldWebContentsBePrerendered(content::WebContents* web_contents) const; |
198 | 191 |
199 // Checks whether |url| has been recently navigated to. | 192 // Checks whether |url| has been recently navigated to. |
200 bool HasRecentlyBeenNavigatedTo(const GURL& url); | 193 bool HasRecentlyBeenNavigatedTo(const GURL& url); |
(...skipping 29 matching lines...) Expand all Loading... | |
230 FinalStatus final_status) const; | 223 FinalStatus final_status) const; |
231 | 224 |
232 const Config& config() const { return config_; } | 225 const Config& config() const { return config_; } |
233 Config& mutable_config() { return config_; } | 226 Config& mutable_config() { return config_; } |
234 | 227 |
235 PrerenderTracker* prerender_tracker() { return prerender_tracker_; } | 228 PrerenderTracker* prerender_tracker() { return prerender_tracker_; } |
236 | 229 |
237 // Adds a condition. This is owned by the PrerenderManager. | 230 // Adds a condition. This is owned by the PrerenderManager. |
238 void AddCondition(const PrerenderCondition* condition); | 231 void AddCondition(const PrerenderCondition* condition); |
239 | 232 |
240 bool IsPendingEntry(const GURL& url) const; | |
241 | |
242 // Returns true if |url| matches any URLs being prerendered. | |
243 bool IsPrerendering(const GURL& url) const; | |
244 | |
245 // Records that some visible tab navigated (or was redirected) to the | 233 // Records that some visible tab navigated (or was redirected) to the |
246 // provided URL. | 234 // provided URL. |
247 void RecordNavigation(const GURL& url); | 235 void RecordNavigation(const GURL& url); |
248 | 236 |
249 Profile* profile() const { return profile_; } | 237 Profile* profile() const { return profile_; } |
250 | 238 |
251 PrerenderHistograms* histograms() const { return histograms_.get(); } | 239 PrerenderHistograms* histograms() const { return histograms_.get(); } |
252 | 240 |
253 protected: | 241 protected: |
242 friend class PrerenderContents; | |
243 friend class PrerenderHandle; | |
244 | |
254 void SetPrerenderContentsFactory( | 245 void SetPrerenderContentsFactory( |
255 PrerenderContents::Factory* prerender_contents_factory); | 246 PrerenderContents::Factory* prerender_contents_factory); |
256 | 247 |
248 // Adds a prerender from a pending Prerender, called by | |
249 // PrerenderContents::StartPendingPrerenders. | |
250 void StartPendingPrerender( | |
251 PrerenderHandle* existing_prerender_handle, | |
252 Origin origin, | |
253 int process_id, | |
254 const GURL& url, | |
255 const content::Referrer& referrer, | |
256 const gfx::Size& size, | |
257 content::SessionStorageNamespace* session_storage_namespace); | |
258 | |
259 void DestroyPendingPrerenderData( | |
260 PrerenderHandle::PrerenderData* pending_prerender_data); | |
261 | |
257 // Utility method that is called from the virtual Shutdown method on this | 262 // Utility method that is called from the virtual Shutdown method on this |
258 // class but is called directly from the TestPrerenderManager in the unit | 263 // class but is called directly from the TestPrerenderManager in the unit |
259 // tests. | 264 // tests. |
260 void DoShutdown(); | 265 void DoShutdown(); |
261 | 266 |
262 private: | 267 private: |
263 // Test that needs needs access to internal functions. | 268 friend class TestPrerenderManager; |
264 friend class PrerenderBrowserTest; | 269 friend class PrerenderBrowserTest; |
265 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, AliasURLTest); | |
266 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, CancelAllTest); | |
267 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, | |
268 CancelOmniboxRemovesOmniboxTest); | |
269 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, | |
270 CancelOmniboxDoesNotRemoveLinkTest); | |
271 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, ClearTest); | |
272 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, ControlGroup); | |
273 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, DropOldestRequestTest); | |
274 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, DropSecondRequestTest); | |
275 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, ExpireTest); | |
276 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, FoundTest); | |
277 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, FragmentMatchesFragmentTest); | |
278 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, FragmentMatchesPageTest); | |
279 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, LinkManagerAbandon); | |
280 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, LinkManagerAddTwiceAbandonTwice); | |
281 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, LinkManagerAddTwiceCancelTwice); | |
282 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, | |
283 LinkManagerAddTwiceCancelTwiceThenAbandonTwice); | |
284 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, LinkManagerCancel); | |
285 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, LinkManagerCancelThenAbandon); | |
286 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, LinkManagerCancelThenAddAgain); | |
287 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, LinkManagerCancelTwice); | |
288 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, LinkManagerExpireThenAddAgain); | |
289 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, LinkManagerExpireThenCancel); | |
290 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, NotSoRecentlyVisited); | |
291 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, PageMatchesFragmentTest); | |
292 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, PendingPrerenderTest); | |
293 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, PPLTDummy); | |
294 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, RateLimitInWindowTest); | |
295 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, RateLimitOutsideWindowTest); | |
296 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, RecentlyVisitedPPLTDummy); | |
297 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, SourceRenderViewClosed); | |
298 FRIEND_TEST_ALL_PREFIXES(PrerenderTest, TwoElementPrerenderTest); | |
299 | 270 |
300 struct PrerenderContentsData; | 271 class OnCloseTabContentsDeleter; |
301 struct NavigationRecord; | 272 struct NavigationRecord; |
302 | 273 |
303 class OnCloseTabContentsDeleter; | 274 typedef PrerenderHandle::PrerenderData PrerenderData; |
dominich
2012/07/02 20:43:03
I'm not convinced this typedef makes the code clea
gavinp
2012/07/03 16:41:02
Done.
| |
275 typedef std::map<const PrerenderData*, base::WeakPtrFactory<PrerenderData>*> | |
276 PrerenderWeakPtrFactoryMap; | |
304 | 277 |
305 typedef std::list<PrerenderContentsData> PrerenderContentsDataList; | |
306 typedef base::hash_map<content::WebContents*, bool> WouldBePrerenderedMap; | 278 typedef base::hash_map<content::WebContents*, bool> WouldBePrerenderedMap; |
307 | 279 |
308 // Time window for which we record old navigations, in milliseconds. | 280 // Time window for which we record old navigations, in milliseconds. |
309 static const int kNavigationRecordWindowMs = 5000; | 281 static const int kNavigationRecordWindowMs = 5000; |
310 | 282 |
311 // Adds a prerender for |url| from referrer |referrer| initiated from the | 283 // Adds a prerender for |url| from |referrer| initiated from the process |
312 // child process specified by |child_id|. The |origin| specifies how the | 284 // |child_id|. The |origin| specifies how the prerender was added. If |size| |
313 // prerender was added. If the |size| is empty, then | 285 // is empty, then PrerenderContents::StartPrerendering will instead use the |
314 // PrerenderContents::StartPrerendering will instead use the size of the | 286 // size of the currently active tab. If the current active tab size cannot be |
315 // currently active tab. If the current active tab size cannot be found, it | 287 // found, it then uses a default from PrerenderConfig. If |prerender_handle| |
dominich
2012/07/02 20:43:03
update comment - no prerender_handle parameter.
gavinp
2012/07/03 16:41:02
Done.
| |
316 // then uses a default from PrerenderConfig. | 288 // is NULL, then AddPrerender will allocate a handle for the caller if |
317 bool AddPrerender( | 289 // successful. |
290 PrerenderHandle* AddPrerender( | |
318 Origin origin, | 291 Origin origin, |
319 int child_id, | 292 int child_id, |
320 const GURL& url, | 293 const GURL& url, |
321 const content::Referrer& referrer, | 294 const content::Referrer& referrer, |
322 gfx::Size size, | 295 gfx::Size size, |
323 content::SessionStorageNamespace* session_storage_namespace); | 296 content::SessionStorageNamespace* session_storage_namespace); |
324 | 297 |
325 // Retrieves the PrerenderContents object for the specified URL, if it | 298 void StartSchedulingPeriodicCleanups(); |
326 // has been prerendered. The caller will then have ownership of the | 299 void StopSchedulingPeriodicCleanups(); |
327 // PrerenderContents object and is responsible for freeing it. | |
328 // Returns NULL if the specified URL has not been prerendered. | |
329 PrerenderContents* GetEntry(const GURL& url); | |
330 | 300 |
331 // Identical to GetEntry, with one exception: | 301 void EvictOldestPrerendersIfNecessary(); |
332 // The WebContents specified indicates the WC in which to swap the | |
333 // prerendering into. If the WebContents specified is the one | |
334 // to doing the prerendered itself, will return NULL. | |
335 PrerenderContents* GetEntryButNotSpecifiedWC(const GURL& url, | |
336 content::WebContents* wc); | |
337 | |
338 // Starts scheduling periodic cleanups. | |
339 void StartSchedulingPeriodicCleanups(); | |
340 // Stops scheduling periodic cleanups if they're no longer needed. | |
341 void MaybeStopSchedulingPeriodicCleanups(); | |
342 | 302 |
343 // Deletes stale and cancelled prerendered PrerenderContents, as well as | 303 // Deletes stale and cancelled prerendered PrerenderContents, as well as |
344 // WebContents that have been replaced by prerendered WebContents. | 304 // WebContents that have been replaced by prerendered WebContents. |
345 // Also identifies and kills PrerenderContents that use too much | 305 // Also identifies and kills PrerenderContents that use too much |
346 // resources. | 306 // resources. |
347 void PeriodicCleanup(); | 307 void PeriodicCleanup(); |
348 | 308 |
349 // Posts a task to call PeriodicCleanup. Results in quicker destruction of | 309 // Posts a task to call PeriodicCleanup. Results in quicker destruction of |
350 // objects. If |this| is deleted before the task is run, the task will | 310 // objects. If |this| is deleted before the task is run, the task will |
351 // automatically be cancelled. | 311 // automatically be cancelled. |
352 void PostCleanupTask(); | 312 void PostCleanupTask(); |
353 | 313 |
354 base::TimeDelta GetMaxAge() const; | 314 base::TimeDelta GetMaxAge() const; |
355 bool IsPrerenderElementFresh(const base::Time start) const; | 315 bool IsPrerenderFresh(base::TimeTicks start) const; |
356 void DeleteOldEntries(); | 316 void DeleteOldEntries(); |
357 virtual base::Time GetCurrentTime() const; | 317 virtual base::Time GetCurrentTime() const; |
358 virtual base::TimeTicks GetCurrentTimeTicks() const; | 318 virtual base::TimeTicks GetCurrentTimeTicks() const; |
359 virtual PrerenderContents* CreatePrerenderContents( | 319 virtual PrerenderContents* CreatePrerenderContents( |
360 const GURL& url, | 320 const GURL& url, |
361 const content::Referrer& referrer, | 321 const content::Referrer& referrer, |
362 Origin origin, | 322 Origin origin, |
363 uint8 experiment_id); | 323 uint8 experiment_id); |
364 | 324 |
365 // Deletes any PrerenderContents that have been added to the pending delete | 325 // Deletes any PrerenderContents that have been added to the pending delete |
366 // list. | 326 // list. |
367 void DeletePendingDeleteEntries(); | 327 void DeletePendingDeleteEntries(); |
368 | 328 |
369 // Finds the specified PrerenderContentsData/PrerenderContents and returns it, | 329 PrerenderHandle* CreatePrerenderHandleForPrerenderData( |
370 // if it exists. Returns NULL otherwise. Unlike GetEntry, the | 330 PrerenderData* prerender_data); |
371 // PrerenderManager maintains ownership of the PrerenderContents. | |
372 PrerenderContentsData* FindEntryData(const GURL& url); | |
373 PrerenderContents* FindEntry(const GURL& url) const; | |
374 | 331 |
375 // Returns the iterator to the PrerenderContentsData entry that is being | 332 void InvalidatePrerenderHandlesForPrerenderData( |
376 // prerendered from the given child route id pair. | 333 const PrerenderData& prerender_data); |
377 PrerenderContentsDataList::iterator | |
378 FindPrerenderContentsForChildRouteIdPair( | |
379 const std::pair<int, int>& child_route_id_pair); | |
380 | 334 |
381 PrerenderContentsDataList::iterator | 335 // Finds the active PrerenderData object for a running prerender matching |
382 FindPrerenderContentsForURL(const GURL& url); | 336 // |url| and |session_storage_namespace|. |
337 PrerenderData* FindPrerenderData( | |
338 const GURL& url, | |
339 const content::SessionStorageNamespace* session_storage_namespace); | |
340 | |
341 // Finds the active PrerenderData object for a running prerender corresponding | |
342 // to the renderer process |child_id| and the render view in |route_id|. | |
343 PrerenderData* FindPrerenderDataForChildAndRoute(int child_id, | |
344 int route_id); | |
345 | |
346 // Given the |prerender_contents|, find the iterator in active_prerender_list_ | |
347 // correponding to that running prerender. | |
348 std::list<PrerenderData>::iterator FindIteratorForPrerenderContents( | |
349 PrerenderContents* prerender_contents); | |
383 | 350 |
384 bool DoesRateLimitAllowPrerender() const; | 351 bool DoesRateLimitAllowPrerender() const; |
385 | 352 |
386 // Deletes old WebContents that have been replaced by prerendered ones. This | 353 // Deletes old WebContents that have been replaced by prerendered ones. This |
387 // is needed because they're replaced in a callback from the old WebContents, | 354 // is needed because they're replaced in a callback from the old WebContents, |
388 // so cannot immediately be deleted. | 355 // so cannot immediately be deleted. |
389 void DeleteOldTabContents(); | 356 void DeleteOldTabContents(); |
390 | 357 |
391 // Cleans up old NavigationRecord's. | 358 // Cleans up old NavigationRecord's. |
392 void CleanUpOldNavigations(); | 359 void CleanUpOldNavigations(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 // of the PrerenderManager. | 400 // of the PrerenderManager. |
434 bool enabled_; | 401 bool enabled_; |
435 | 402 |
436 static bool is_prefetch_enabled_; | 403 static bool is_prefetch_enabled_; |
437 | 404 |
438 // The profile that owns this PrerenderManager. | 405 // The profile that owns this PrerenderManager. |
439 Profile* profile_; | 406 Profile* profile_; |
440 | 407 |
441 PrerenderTracker* prerender_tracker_; | 408 PrerenderTracker* prerender_tracker_; |
442 | 409 |
443 // List of prerendered elements. | 410 // List of all running prerenders. |
444 PrerenderContentsDataList prerender_list_; | 411 // It is kept sorted, in increasing order by expiry time. The STL list was |
412 // chosen because it does not move items in memory (this lets handles continue | |
413 // to point to their PrerenderData). | |
414 std::list<PrerenderData> active_prerender_list_; | |
415 | |
416 // List of all pending prerenders. | |
417 std::list<PrerenderData> pending_prerender_list_; | |
418 | |
419 // The prerenders in the above list need WeakPtrs to instantiate their | |
420 // handle. Keep them here for the lifetime of each element in the list. | |
421 PrerenderWeakPtrFactoryMap prerender_weak_ptr_factory_map_; | |
422 | |
445 | 423 |
446 // List of recent navigations in this profile, sorted by ascending | 424 // List of recent navigations in this profile, sorted by ascending |
447 // navigate_time_. | 425 // navigate_time_. |
448 std::list<NavigationRecord> navigations_; | 426 std::list<NavigationRecord> navigations_; |
449 | 427 |
450 // List of prerender elements to be deleted | 428 // List of prerender elements to be deleted |
451 std::list<PrerenderContents*> pending_delete_list_; | 429 std::list<PrerenderContents*> pending_delete_list_; |
452 | 430 |
453 // Set of WebContents which are currently displaying a prerendered page. | 431 // Set of WebContents which are currently displaying a prerendered page. |
454 base::hash_set<content::WebContents*> prerendered_tab_contents_set_; | 432 base::hash_set<content::WebContents*> prerendered_tab_contents_set_; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
496 | 474 |
497 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 475 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
498 }; | 476 }; |
499 | 477 |
500 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 478 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
501 int render_process_id); | 479 int render_process_id); |
502 | 480 |
503 } // namespace prerender | 481 } // namespace prerender |
504 | 482 |
505 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 483 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |