summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-12 22:50:18 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-12 22:50:18 +0000
commita8c699eaad9a0516e81e6e01c2c4554162733636 (patch)
treeacbb0e1646f814c3c3178606372021d6cd60fe2f
parent6839813b88137a9de6d2343c89a59d5409a8e44b (diff)
downloadchromium_src-a8c699eaad9a0516e81e6e01c2c4554162733636.zip
chromium_src-a8c699eaad9a0516e81e6e01c2c4554162733636.tar.gz
chromium_src-a8c699eaad9a0516e81e6e01c2c4554162733636.tar.bz2
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
-rw-r--r--chrome/browser/prerender/prerender_manager.cc17
-rw-r--r--chrome/browser/prerender/prerender_manager.h9
2 files changed, 16 insertions, 10 deletions
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc
index d36a502..4f0c083 100644
--- a/chrome/browser/prerender/prerender_manager.cc
+++ b/chrome/browser/prerender/prerender_manager.cc
@@ -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,
diff --git a/chrome/browser/prerender/prerender_manager.h b/chrome/browser/prerender/prerender_manager.h
index 6861b7b..aad510e 100644
--- a/chrome/browser/prerender/prerender_manager.h
+++ b/chrome/browser/prerender/prerender_manager.h
@@ -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.