Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(724)

Side by Side Diff: chrome/browser/prerender/prerender_manager.h

Issue 6685012: Give prerendering RVH's RenderWidgetHostViews. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Comment typos fixed Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <map>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 PRERENDER_MODE_DISABLED, 46 PRERENDER_MODE_DISABLED,
47 PRERENDER_MODE_ENABLED, 47 PRERENDER_MODE_ENABLED,
48 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP, 48 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP,
49 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP, 49 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP,
50 PRERENDER_MODE_MAX 50 PRERENDER_MODE_MAX
51 }; 51 };
52 52
53 // Owned by a Profile object for the lifetime of the profile. 53 // Owned by a Profile object for the lifetime of the profile.
54 explicit PrerenderManager(Profile* profile); 54 explicit PrerenderManager(Profile* profile);
55 55
56 // Preloads the URL supplied. alias_urls indicates URLs that redirect 56 // Preloads |url| if valid. |alias_urls| indicates URLs that redirect
57 // to the same URL to be preloaded. Returns true if the URL was added, 57 // to the same URL to be preloaded. |child_route_id_pair| identifies the
58 // false if it was not. 58 // RenderViewHost that the prerender request came from and is used to
59 bool AddPreload(const GURL& url, const std::vector<GURL>& alias_urls, 59 // set the initial window size of the RenderViewHost used for prerendering.
60 const GURL& referrer); 60 // Returns true if the URL was added, false if it was not.
61 bool AddPreload(
62 const std::pair<int, int>& child_route_id_pair,
63 const GURL& url,
64 const std::vector<GURL>& alias_urls,
65 const GURL& referrer);
61 66
62 void AddPendingPreload(const std::pair<int, int>& child_route_id_pair, 67 void AddPendingPreload(const std::pair<int, int>& child_route_id_pair,
63 const GURL& url, 68 const GURL& url,
64 const std::vector<GURL>& alias_urls, 69 const std::vector<GURL>& alias_urls,
65 const GURL& referrer); 70 const GURL& referrer);
66 71
67 // For a given TabContents that wants to navigate to the URL supplied, 72 // For a given TabContents that wants to navigate to the URL supplied,
68 // determines whether a preloaded version of the URL can be used, 73 // determines whether a preloaded version of the URL can be used,
69 // and substitutes the prerendered RVH into the TabContents. Returns 74 // and substitutes the prerendered RVH into the TabContents. Returns
70 // whether or not a prerendered RVH could be used or not. 75 // whether or not a prerendered RVH could be used or not.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // Starts and stops scheduling periodic cleanups, respectively. 157 // Starts and stops scheduling periodic cleanups, respectively.
153 void StartSchedulingPeriodicCleanups(); 158 void StartSchedulingPeriodicCleanups();
154 void StopSchedulingPeriodicCleanups(); 159 void StopSchedulingPeriodicCleanups();
155 160
156 // Deletes stale prerendered PrerenderContents. 161 // Deletes stale prerendered PrerenderContents.
157 // Also identifies and kills PrerenderContents that use too much 162 // Also identifies and kills PrerenderContents that use too much
158 // resources. 163 // resources.
159 void PeriodicCleanup(); 164 void PeriodicCleanup();
160 165
161 bool IsPrerenderElementFresh(const base::Time start) const; 166 bool IsPrerenderElementFresh(const base::Time start) const;
167 // Destroy entries that have a pending final status or are expired.
162 void DeleteOldEntries(); 168 void DeleteOldEntries();
163 virtual base::Time GetCurrentTime() const; 169 virtual base::Time GetCurrentTime() const;
164 virtual base::TimeTicks GetCurrentTimeTicks() const; 170 virtual base::TimeTicks GetCurrentTimeTicks() const;
165 virtual PrerenderContents* CreatePrerenderContents( 171 virtual PrerenderContents* CreatePrerenderContents(
166 const GURL& url, 172 const GURL& url,
167 const std::vector<GURL>& alias_urls, 173 const std::vector<GURL>& alias_urls,
168 const GURL& referrer); 174 const GURL& referrer);
169 175
170 // Finds the specified PrerenderContents and returns it, if it exists. 176 // Finds the specified PrerenderContents and returns it, if it exists.
171 // Returns NULL otherwise. Unlike GetEntry, the PrerenderManager maintains 177 // Returns NULL otherwise. Unlike GetEntry, the PrerenderManager maintains
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 249
244 // Track time of last prerender to limit prerender spam. 250 // Track time of last prerender to limit prerender spam.
245 base::TimeTicks last_prerender_start_time_; 251 base::TimeTicks last_prerender_start_time_;
246 252
247 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); 253 DISALLOW_COPY_AND_ASSIGN(PrerenderManager);
248 }; 254 };
249 255
250 } // prerender 256 } // prerender
251 257
252 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ 258 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698