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

Unified Diff: chrome/browser/prerender/prerender_contents.h

Issue 10553029: Handle interface to prerenders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more standard code, simpler handle, no class explosion Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prerender/prerender_contents.h
diff --git a/chrome/browser/prerender/prerender_contents.h b/chrome/browser/prerender/prerender_contents.h
index 0e1f4988ba8c0b2deccd458cd7c08153ff205096..f598cc043d42c08baf406ec0568cc60672cc895e 100644
--- a/chrome/browser/prerender/prerender_contents.h
+++ b/chrome/browser/prerender/prerender_contents.h
@@ -37,6 +37,7 @@ class WebContents;
namespace prerender {
+class PrerenderHandle;
class PrerenderManager;
class PrerenderRenderViewHostObserver;
class PrerenderTracker;
@@ -66,6 +67,13 @@ class PrerenderContents : public content::NotificationObserver,
DISALLOW_COPY_AND_ASSIGN(Factory);
};
+ // Predicate functor used in maps to sort by load start time.
+ class LessThanByLoadStartTime {
dominich 2012/06/22 15:36:16 public?
+ public:
+ bool operator() (const PrerenderContents* lhs,
+ const PrerenderContents* rhs) const;
+ };
+
// Information on pages that the prerendered page has tried to prerender.
struct PendingPrerenderInfo;
typedef std::list<PendingPrerenderInfo> PendingPrerenderList;
@@ -80,7 +88,7 @@ class PrerenderContents : public content::NotificationObserver,
// MatchComplete.
MATCH_COMPLETE_DEFAULT,
// A prerender that used to be a regular prerender, but has since been
- // replaced by a MatchComplete dummy. Therefore, we will record this only
+ // replaced by a MatchComplete dummy. Therefore, we will record this only
// for Match, but not for MatchComplete.
MATCH_COMPLETE_REPLACED,
// A prerender that is a MatchComplete dummy replacing a regular prerender.
@@ -95,6 +103,10 @@ class PrerenderContents : public content::NotificationObserver,
virtual ~PrerenderContents();
+ // For MatchComplete correctness, create a dummy replacement prerender contents
+ // to stand in for this prerender contents that (which we are about to destroy).
+ PrerenderContents* CreateDummyReplacement() const;
+
bool Init();
static Factory* CreateFactory();
@@ -153,6 +165,10 @@ class PrerenderContents : public content::NotificationObserver,
Origin origin() const { return origin_; }
uint8 experiment_id() const { return experiment_id_; }
+ int client_count() const { return client_count_; }
dominich 2012/06/22 15:36:16 naming nit: I don't know what a client is or what
+ void IncrementClientCount();
+ void DecrementClientCount();
+
base::TimeTicks load_start_time() const { return load_start_time_; }
// Indicates whether this prerendered page can be used for the provided
@@ -160,7 +176,9 @@ class PrerenderContents : public content::NotificationObserver,
// set to the URL that is found as a match if it is provided.
// TODO(gavinp,mmenke): Rework matching to be based on both the URL
// and the session WebStorage.
- bool MatchesURL(const GURL& url, GURL* matching_url) const;
+ bool Matches(
+ const GURL& url,
+ const content::SessionStorageNamespace* session_storage_namespace);
void OnJSOutOfMemory();
bool ShouldSuppressDialogs();
@@ -216,12 +234,13 @@ class PrerenderContents : public content::NotificationObserver,
bool IsCrossSiteNavigationPending() const;
// Adds a pending prerender to the list.
- virtual void AddPendingPrerender(const GURL& url,
+ virtual void AddPendingPrerender(scoped_ptr<PrerenderHandle> prerender_handle,
dominich 2012/06/22 15:36:16 I don't know why, but seeing a scoped_ptr<> passed
+ const GURL& url,
const content::Referrer& referrer,
const gfx::Size& size);
// Returns true if |url| corresponds to a pending prerender.
- bool IsPendingEntry(const GURL& url) const;
+ bool IsPendingEntry(const PrerenderHandle* prerender_handle) const;
dominich 2012/06/22 15:36:16 if |prerender_handle| can never be NULL, prefer pa
// Reissues any pending prerender requests from the prerendered page. Also
// clears the list of pending requests.
@@ -258,6 +277,11 @@ class PrerenderContents : public content::NotificationObserver,
bool prerendering_has_started_;
+ // Time at which we started to load the URL. This is used to compute
+ // the time elapsed from initiating a prerender until the time the
+ // (potentially only partially) prerendered page is shown to the user.
dominich 2012/06/22 15:36:16 Is it not used to potentially expire stale prerend
+ base::TimeTicks load_start_time_;
dominich 2012/06/22 15:36:16 The move to protected is unexpected as I thought P
+
private:
class TabContentsDelegateImpl;
@@ -306,6 +330,10 @@ class PrerenderContents : public content::NotificationObserver,
// such as HTTP redirects or javascript redirects.
std::vector<GURL> alias_urls_;
+ // Number of distinct clients of this prerendered page (distinct link elements
+ // for instance).
dominich 2012/06/22 15:36:16 Ah - maybe instance_count_ ?
+ int client_count_;
+
bool has_stopped_loading_;
// True when the main frame has finished loading.
@@ -324,11 +352,6 @@ class PrerenderContents : public content::NotificationObserver,
// Used solely to prevent double deletion.
bool prerendering_has_been_cancelled_;
- // Time at which we started to load the URL. This is used to compute
- // the time elapsed from initiating a prerender until the time the
- // (potentially only partially) prerendered page is shown to the user.
- base::TimeTicks load_start_time_;
-
// Process Metrics of the render process associated with the
// RenderViewHost for this object.
scoped_ptr<base::ProcessMetrics> process_metrics_;

Powered by Google App Engine
This is Rietveld 408576698