Commit c8a08259 authored by Hiroki Nakagawa's avatar Hiroki Nakagawa Committed by Commit Bot

Prerender: Remove unused process id and routing id from PrerenderContents

These were added by https://codereview.chromium.org/6625066 for the
legacy prerender, but these are not used for the current
no-state-prefetch.

Bug: 755921
Change-Id: I7536260cbf2f33f7f99da8bfa458fdc1702bff55
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2437553Reviewed-by: default avatarRyan Sturm <ryansturm@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811869}
parent 1f454b1b
......@@ -95,18 +95,6 @@ class DummyPrerenderContents : public PrerenderContents {
const gfx::Rect& bounds,
content::SessionStorageNamespace* session_storage_namespace) override;
bool GetChildId(int* child_id) const override {
// Having a default child_id of -1 forces pending prerenders not to fail
// on session storage and cross domain checking.
*child_id = -1;
return true;
}
bool GetRouteId(int* route_id) const override {
*route_id = route_id_;
return true;
}
FinalStatus expected_final_status() const { return expected_final_status_; }
bool prerendering_has_been_cancelled() const {
......
......@@ -142,8 +142,6 @@ PrerenderContents::PrerenderContents(
final_status_(FINAL_STATUS_UNKNOWN),
prerendering_has_been_cancelled_(false),
process_pid_(base::kNullProcessId),
child_id_(-1),
route_id_(-1),
origin_(origin),
network_bytes_(0) {
switch (origin) {
......@@ -204,16 +202,11 @@ void PrerenderContents::StartPrerendering(
content::WebContentsObserver::Observe(prerender_contents_.get());
delegate_->OnPrerenderContentsCreated(prerender_contents_.get());
web_contents_delegate_.reset(new WebContentsDelegateImpl(this));
prerender_contents_.get()->SetDelegate(web_contents_delegate_.get());
web_contents_delegate_ = std::make_unique<WebContentsDelegateImpl>(this);
prerender_contents_->SetDelegate(web_contents_delegate_.get());
// Set the size of the prerender WebContents.
prerender_contents_.get()->Resize(bounds_);
// TODO(davidben): This logic assumes each prerender has at most one
// route. https://crbug.com/440544
child_id_ = GetRenderViewHost()->GetProcess()->GetID();
route_id_ = GetRenderViewHost()->GetRoutingID();
prerender_contents_->Resize(bounds_);
// TODO(davidben): This logic assumes each prerender has at most one
// process. https://crbug.com/440544
......@@ -238,21 +231,7 @@ void PrerenderContents::StartPrerendering(
load_url_params.transition_type =
ui::PageTransitionFromInt(ui::PAGE_TRANSITION_GENERATED);
}
prerender_contents_.get()->GetController().LoadURLWithParams(load_url_params);
}
bool PrerenderContents::GetChildId(int* child_id) const {
CHECK(child_id);
DCHECK_GE(child_id_, -1);
*child_id = child_id_;
return child_id_ != -1;
}
bool PrerenderContents::GetRouteId(int* route_id) const {
CHECK(route_id);
DCHECK_GE(route_id_, -1);
*route_id = route_id_;
return route_id_ != -1;
prerender_contents_->GetController().LoadURLWithParams(load_url_params);
}
void PrerenderContents::SetFinalStatus(FinalStatus final_status) {
......@@ -295,7 +274,7 @@ void PrerenderContents::Observe(int type,
const content::NotificationDetails& details) {
switch (type) {
case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: {
if (prerender_contents_.get()) {
if (prerender_contents_) {
DCHECK_EQ(content::Source<WebContents>(source).ptr(),
prerender_contents_.get());
......
......@@ -140,14 +140,6 @@ class PrerenderContents : public content::NotificationObserver,
bool has_finished_loading() const { return has_finished_loading_; }
bool prerendering_has_started() const { return prerendering_has_started_; }
// Sets the parameter to the value of the associated RenderViewHost's child id
// and returns a boolean indicating the validity of that id.
virtual bool GetChildId(int* child_id) const;
// Sets the parameter to the value of the associated RenderViewHost's route id
// and returns a boolean indicating the validity of that id.
virtual bool GetRouteId(int* route_id) const;
FinalStatus final_status() const { return final_status_; }
Origin origin() const { return origin_; }
......@@ -292,14 +284,14 @@ class PrerenderContents : public content::NotificationObserver,
std::unique_ptr<PrerenderContentsDelegate> delegate_;
// The URL being prerendered.
GURL prerender_url_;
const GURL prerender_url_;
// The referrer.
content::Referrer referrer_;
const content::Referrer referrer_;
// The origin of the page requesting the prerender. Empty when the prerender
// is browser initiated.
base::Optional<url::Origin> initiator_origin_;
const base::Optional<url::Origin> initiator_origin_;
// The browser context being used
content::BrowserContext* browser_context_;
......@@ -326,12 +318,8 @@ class PrerenderContents : public content::NotificationObserver,
std::unique_ptr<WebContentsDelegateImpl> web_contents_delegate_;
// These are -1 before a RenderView is created.
int child_id_;
int route_id_;
// Origin for this prerender.
Origin origin_;
const Origin origin_;
// The bounds of the WebView from the launching page.
gfx::Rect bounds_;
......
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