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

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: remediated, and cleaned up in prep for uploading for review 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 6156d486d3a56ddbfb413bd965ae7132b4aa9e69..62ed4e7e42cbd5b4d25c3913be6b7b976bff40c2 100644
--- a/chrome/browser/prerender/prerender_contents.h
+++ b/chrome/browser/prerender/prerender_contents.h
@@ -15,6 +15,7 @@
#include "base/time.h"
#include "base/values.h"
#include "chrome/browser/prerender/prerender_final_status.h"
+#include "chrome/browser/prerender/prerender_handle.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
@@ -66,10 +67,6 @@ class PrerenderContents : public content::NotificationObserver,
DISALLOW_COPY_AND_ASSIGN(Factory);
};
- // Information on pages that the prerendered page has tried to prerender.
- struct PendingPrerenderInfo;
- typedef std::list<PendingPrerenderInfo> PendingPrerenderList;
-
// Indicates how this PrerenderContents relates to MatchComplete. This is to
// figure out which histograms to use to record the FinalStatus, Match (record
// all prerenders and control group prerenders) or MatchComplete (record
@@ -80,7 +77,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 +92,12 @@ 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).
+ void MakeIntoDummyReplacementOf(
dominich 2012/06/28 00:34:32 can this be a separate CL?
+ const PrerenderContents* original_prerender_contents);
+
bool Init();
static Factory* CreateFactory();
@@ -153,6 +156,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/28 00:34:32 usage count? instance count?
+ 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 +167,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(
dominich 2012/06/28 00:34:32 we didn't use the returned matching_url anywhere?
+ const GURL& url,
+ const content::SessionStorageNamespace* session_storage_namespace);
// content::WebContentsObserver implementation.
virtual void DidStopLoading() OVERRIDE;
@@ -212,19 +221,33 @@ class PrerenderContents : public content::NotificationObserver,
// MouseEvent being dispatched by a link to a website installed as an app.
bool IsCrossSiteNavigationPending() const;
- // Adds a pending prerender to the list.
- virtual void AddPendingPrerender(const GURL& url,
- const content::Referrer& referrer,
- const gfx::Size& size);
+ virtual PrerenderHandle AddPendingPrerender(const GURL& url,
+ const content::Referrer& referrer,
+ const gfx::Size& size);
// Returns true if |url| corresponds to a pending prerender.
dominich 2012/06/28 00:34:32 comment
- bool IsPendingEntry(const GURL& url) const;
+ bool IsPendingEntry(PrerenderHandle prerender_handle) const;
// Reissues any pending prerender requests from the prerendered page. Also
// clears the list of pending requests.
void StartPendingPrerenders();
protected:
+ // Information on pages that the prerendered page has tried to prerender.
+ struct PendingPrerenderInfo {
dominich 2012/06/28 00:34:32 I believe this can just be a forward reference her
+ PendingPrerenderInfo(PrerenderHandleImpl* prerender_handle_impl,
+ const GURL& url,
+ const content::Referrer& referrer,
+ const gfx::Size& size);
+
+ PrerenderHandleImpl* prerender_handle_impl;
dominich 2012/06/28 00:34:32 const PrerenderHandleImpl?
+ const GURL url;
+ const content::Referrer referrer;
+ const gfx::Size size;
+ };
+ typedef std::list<PendingPrerenderInfo> PendingPrerenderList;
+
dominich 2012/06/28 00:34:32 nit: extra blank line
+
PrerenderContents(PrerenderManager* prerender_manager,
PrerenderTracker* prerender_tracker,
Profile* profile,
@@ -255,6 +278,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.
+ base::TimeTicks load_start_time_;
+
private:
class TabContentsDelegateImpl;
@@ -303,6 +331,15 @@ class PrerenderContents : public content::NotificationObserver,
// such as HTTP redirects or javascript redirects.
std::vector<GURL> alias_urls_;
+ // The session storage namespace for use in Matching. We must save it
+ // rather than get it from the RenderViewHost since in the control group
+ // we won't have a RenderViewHost.
+ content::SessionStorageNamespace* session_storage_namespace_;
+
+ // Number of distinct clients of this prerendered page (distinct link elements
dominich 2012/06/28 00:34:32 instances?
+ // for instance).
+ int client_count_;
+
bool has_stopped_loading_;
// True when the main frame has finished loading.
@@ -321,11 +358,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