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

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

Issue 11028037: Fix prerender histograms for multiple prerender case. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... whitespace Created 8 years, 2 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_manager.h
diff --git a/chrome/browser/prerender/prerender_manager.h b/chrome/browser/prerender/prerender_manager.h
index 0245b2c992cc9b40150bcb0308cae751941c5fc2..ede15169c0c740abcbd0450d7b18a605183dc69d 100644
--- a/chrome/browser/prerender/prerender_manager.h
+++ b/chrome/browser/prerender/prerender_manager.h
@@ -159,6 +159,11 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
content::WebContents* web_contents,
const GURL& url);
+ // Records the percentage of pixels of the final page in place at swap-in.
+ void RecordFractionPixelsFinalAtSwapin(
+ content::WebContents* web_contents,
+ double fraction);
+
// Set whether prerendering is currently enabled for this manager.
// Must be called on the UI thread.
// If |enabled| is false, existing prerendered pages will still persist until
@@ -189,14 +194,22 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
// Maintaining and querying the set of WebContents belonging to this
// PrerenderManager that are currently showing prerendered pages.
- void MarkWebContentsAsPrerendered(content::WebContents* web_contents);
+ void MarkWebContentsAsPrerendered(content::WebContents* web_contents,
+ Origin origin);
+
void MarkWebContentsAsWouldBePrerendered(content::WebContents* web_contents);
void MarkWebContentsAsNotPrerendered(content::WebContents* web_contents);
- bool IsWebContentsPrerendered(content::WebContents* web_contents) const;
+
+ // Returns true if |web_contents| is being prerendered. The optional parameter
+ // |origin| is an output parameter which if passed non-null is set to point
+ // to the Origin of that prerender if one is found, NULL otherwise.
+ bool IsWebContentsPrerendered(content::WebContents* web_contents,
+ const Origin** origin) const;
+
bool WouldWebContentsBePrerendered(content::WebContents* web_contents) const;
// Checks whether |url| has been recently navigated to.
- bool HasRecentlyBeenNavigatedTo(const GURL& url);
+ bool HasRecentlyBeenNavigatedTo(Origin origin, const GURL& url);
// Returns true if the method given is invalid for prerendering.
static bool IsValidHttpMethod(const std::string& method);
@@ -242,7 +255,7 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
Profile* profile() const { return profile_; }
- PrerenderHistograms* histograms() const { return histograms_.get(); }
+ PrerenderHistograms* histograms() { return histograms_.get(); }
protected:
class PrerenderData : public base::SupportsWeakPtr<PrerenderData> {
@@ -334,6 +347,11 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
class OnCloseTabContentsDeleter;
struct NavigationRecord;
+ struct PrerenderedWebContentsData {
+ Origin origin;
+
+ explicit PrerenderedWebContentsData(Origin origin);
+ };
typedef base::hash_map<content::WebContents*, bool> WouldBePrerenderedMap;
@@ -411,7 +429,7 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
std::list<linked_ptr<PrerenderData> >::iterator
FindIteratorForPrerenderContents(PrerenderContents* prerender_contents);
- bool DoesRateLimitAllowPrerender() const;
+ bool DoesRateLimitAllowPrerender(Origin origin) const;
// Deletes old WebContents that have been replaced by prerendered ones. This
// is needed because they're replaced in a callback from the old WebContents,
@@ -485,7 +503,8 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
std::list<PrerenderContents*> pending_delete_list_;
// Set of WebContents which are currently displaying a prerendered page.
mmenke 2012/10/05 17:01:15 While you're here, could you clarify this comment?
gavinp 2012/10/05 20:43:35 Done.
- base::hash_set<content::WebContents*> prerendered_tab_contents_set_;
+ base::hash_map<content::WebContents*, PrerenderedWebContentsData>
+ prerendered_web_contents_data_;
// WebContents that would have been swapped out for a prerendered WebContents
// if the user was not part of the control group for measurement. When the

Powered by Google App Engine
This is Rietveld 408576698