Commit a8c699ea authored by mmenke@chromium.org's avatar mmenke@chromium.org

Add to the prerender history when no PrerenderContents is created.

Without this, the net-internals prerendering tests fail when a cancel
that creates a PrerenderContents is replaced with one that does not.

BUG=372471

Review URL: https://codereview.chromium.org/286433002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269900 0039d316-1c4b-4281-b951-d872f2087c98
parent 6839813b
......@@ -1249,7 +1249,8 @@ PrerenderHandle* PrerenderManager::AddPrerender(
if (PrerenderData* preexisting_prerender_data =
FindPrerenderData(url, session_storage_namespace)) {
RecordFinalStatus(origin, experiment, FINAL_STATUS_DUPLICATE);
RecordFinalStatusWithoutCreatingPrerenderContents(
url, origin, experiment, FINAL_STATUS_DUPLICATE);
return new PrerenderHandle(preexisting_prerender_data);
}
......@@ -1267,7 +1268,8 @@ PrerenderHandle* PrerenderManager::AddPrerender(
if (content::RenderProcessHost::ShouldTryToUseExistingProcessHost(
profile_, url) &&
!content::RenderProcessHost::run_renderer_in_process()) {
RecordFinalStatus(origin, experiment, FINAL_STATUS_TOO_MANY_PROCESSES);
RecordFinalStatusWithoutCreatingPrerenderContents(
url, origin, experiment, FINAL_STATUS_TOO_MANY_PROCESSES);
return NULL;
}
......@@ -1276,7 +1278,8 @@ PrerenderHandle* PrerenderManager::AddPrerender(
// Cancel the prerender. We could add it to the pending prerender list but
// this doesn't make sense as the next prerender request will be triggered
// by a navigation and is unlikely to be the same site.
RecordFinalStatus(origin, experiment, FINAL_STATUS_RATE_LIMIT_EXCEEDED);
RecordFinalStatusWithoutCreatingPrerenderContents(
url, origin, experiment, FINAL_STATUS_RATE_LIMIT_EXCEEDED);
return NULL;
}
......@@ -1563,9 +1566,11 @@ void PrerenderManager::DestroyAndMarkMatchCompleteAsUsed(
prerender_contents->Destroy(final_status);
}
void PrerenderManager::RecordFinalStatus(Origin origin,
uint8 experiment_id,
FinalStatus final_status) const {
void PrerenderManager::RecordFinalStatusWithoutCreatingPrerenderContents(
const GURL& url, Origin origin, uint8 experiment_id,
FinalStatus final_status) const {
PrerenderHistory::Entry entry(url, final_status, origin, base::Time::Now());
prerender_history_->AddEntry(entry);
RecordFinalStatusWithMatchCompleteStatus(
origin, experiment_id,
PrerenderContents::MATCH_COMPLETE_DEFAULT,
......
......@@ -621,12 +621,13 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
void DestroyAndMarkMatchCompleteAsUsed(PrerenderContents* prerender_contents,
FinalStatus final_status);
// Record a final status of a prerendered page in a histogram.
// Records the final status a prerender in the case that a PrerenderContents
// was never created, and also adds a PrerenderHistory entry.
// This is a helper function which will ultimately call
// RecordFinalStatusWthMatchCompleteStatus, using MATCH_COMPLETE_DEFAULT.
void RecordFinalStatus(Origin origin,
uint8 experiment_id,
FinalStatus final_status) const;
void RecordFinalStatusWithoutCreatingPrerenderContents(
const GURL& url, Origin origin, uint8 experiment_id,
FinalStatus final_status) const;
// Returns whether prerendering is currently enabled for this manager.
// Must be called on the UI thread.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment