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

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

Issue 107893003: Make the renderer-side prerendering code use RenderFrames instead of RenderViews. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: creis review comments Created 7 years 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.cc
===================================================================
--- chrome/browser/prerender/prerender_contents.cc (revision 239602)
+++ chrome/browser/prerender/prerender_contents.cc (working copy)
@@ -26,6 +26,7 @@
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_child_process_host.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_request_details.h"
@@ -327,6 +328,14 @@
prerender_contents_.get()->GetController().LoadURLWithParams(load_url_params);
}
+void PrerenderContents::PrerenderingDone() {
+ for (std::set<content::RenderFrameHost*>::iterator i =
+ render_frame_hosts_.begin(); i != render_frame_hosts_.end(); ++i) {
+ (*i)->Send(new PrerenderMsg_SetIsPrerendering((*i)->GetRoutingID(), false));
+ }
+ render_frame_hosts_.clear();
+}
+
bool PrerenderContents::GetChildId(int* child_id) const {
CHECK(child_id);
DCHECK_GE(child_id_, -1);
@@ -401,16 +410,6 @@
content::Details<RenderViewHost> new_render_view_host(details);
OnRenderViewHostCreated(new_render_view_host.ptr());
- // When a new RenderView is created for a prerendering WebContents,
- // tell the new RenderView it's being used for prerendering before any
- // navigations occur. Note that this is always triggered before the
- // first navigation, so there's no need to send the message just after
- // the WebContents is created.
- new_render_view_host->Send(
- new PrerenderMsg_SetIsPrerendering(
- new_render_view_host->GetRoutingID(),
- true));
-
// Make sure the size of the RenderViewHost has been passed to the new
// RenderView. Otherwise, the size may not be sent until the
// RenderViewReady event makes it from the render process to the UI
@@ -548,6 +547,22 @@
Destroy(FINAL_STATUS_RENDERER_CRASHED);
}
+void PrerenderContents::RenderFrameCreated(
+ content::RenderFrameHost* render_frame_host) {
+ render_frame_hosts_.insert(render_frame_host);
+ // When a new RenderFrame is created for a prerendering WebContents, tell the
+ // new RenderFrame it's being used for prerendering before any navigations
+ // occur. Note that this is always triggered before the first navigation, so
+ // there's no need to send the message just after the WebContents is created.
+ render_frame_host->Send(new PrerenderMsg_SetIsPrerendering(
+ render_frame_host->GetRoutingID(), true));
mmenke 2013/12/10 20:56:41 Are there any races here? I'm not familiar with f
jam 2013/12/10 21:14:17 no, this is called from the same place that NOTIFI
+}
+
+void PrerenderContents::RenderFrameDeleted(
+ content::RenderFrameHost* render_frame_host) {
+ render_frame_hosts_.erase(render_frame_host);
+}
+
void PrerenderContents::DidStopLoading(
content::RenderViewHost* render_view_host) {
has_stopped_loading_ = true;

Powered by Google App Engine
This is Rietveld 408576698