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

Side by Side Diff: chrome/browser/prerender/prerender_contents.cc

Issue 10553029: Handle interface to prerenders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remediated, and cleaned up in prep for uploading for review Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/prerender/prerender_contents.h" 5 #include "chrome/browser/prerender/prerender_contents.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional>
8 #include <utility> 9 #include <utility>
9 10
11 #include "base/memory/linked_ptr.h"
dominich 2012/06/28 00:34:32 include no longer needed.
10 #include "base/process_util.h" 12 #include "base/process_util.h"
11 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/history/history_tab_helper.h" 14 #include "chrome/browser/history/history_tab_helper.h"
13 #include "chrome/browser/history/history_types.h" 15 #include "chrome/browser/history/history_types.h"
14 #include "chrome/browser/prerender/prerender_final_status.h" 16 #include "chrome/browser/prerender/prerender_final_status.h"
17 #include "chrome/browser/prerender/prerender_handle.h"
dominich 2012/06/28 00:34:32 unnecessary include? included by .h
15 #include "chrome/browser/prerender/prerender_manager.h" 18 #include "chrome/browser/prerender/prerender_manager.h"
16 #include "chrome/browser/prerender/prerender_render_view_host_observer.h" 19 #include "chrome/browser/prerender/prerender_render_view_host_observer.h"
17 #include "chrome/browser/prerender/prerender_tracker.h" 20 #include "chrome/browser/prerender/prerender_tracker.h"
18 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/tab_contents/tab_contents.h" 22 #include "chrome/browser/ui/tab_contents/tab_contents.h"
20 #include "chrome/common/chrome_notification_types.h" 23 #include "chrome/common/chrome_notification_types.h"
21 #include "chrome/common/icon_messages.h" 24 #include "chrome/common/icon_messages.h"
22 #include "chrome/common/prerender_messages.h" 25 #include "chrome/common/prerender_messages.h"
23 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
24 #include "content/public/browser/resource_request_details.h" 27 #include "content/public/browser/resource_request_details.h"
25 #include "content/public/browser/browser_child_process_host.h" 28 #include "content/public/browser/browser_child_process_host.h"
26 #include "content/public/browser/notification_service.h" 29 #include "content/public/browser/notification_service.h"
27 #include "content/public/browser/render_process_host.h" 30 #include "content/public/browser/render_process_host.h"
28 #include "content/public/browser/render_view_host.h" 31 #include "content/public/browser/render_view_host.h"
29 #include "content/public/browser/web_contents.h" 32 #include "content/public/browser/web_contents.h"
30 #include "content/public/browser/web_contents_delegate.h" 33 #include "content/public/browser/web_contents_delegate.h"
31 #include "content/public/browser/web_contents_view.h" 34 #include "content/public/browser/web_contents_view.h"
32 #include "ui/gfx/rect.h" 35 #include "ui/gfx/rect.h"
33 36
34 using content::DownloadItem; 37 using content::DownloadItem;
35 using content::OpenURLParams; 38 using content::OpenURLParams;
36 using content::RenderViewHost; 39 using content::RenderViewHost;
37 using content::ResourceRedirectDetails; 40 using content::ResourceRedirectDetails;
41 using content::SessionStorageNamespace;
38 using content::WebContents; 42 using content::WebContents;
39 43
40 namespace prerender { 44 namespace prerender {
41 45
42 namespace { 46 namespace {
43 47
44 // Compares URLs ignoring any ref for the purposes of matching URLs when
45 // prerendering.
46 struct PrerenderURLPredicate {
47 explicit PrerenderURLPredicate(const GURL& url)
48 : url_(url) {
49 }
50
51 bool operator()(const GURL& url) const {
52 return url.scheme() == url_.scheme() &&
53 url.host() == url_.host() &&
54 url.port() == url_.port() &&
55 url.path() == url_.path() &&
56 url.query() == url_.query();
57 }
58 GURL url_;
59 };
60
61 // Tells the render process at |child_id| whether |url| is a new prerendered 48 // Tells the render process at |child_id| whether |url| is a new prerendered
62 // page, or whether |url| is being removed as a prerendered page. Currently 49 // page, or whether |url| is being removed as a prerendered page. Currently
63 // this will only inform the render process that created the prerendered page 50 // this will only inform the render process that created the prerendered page
64 // with <link rel="prerender"> tags about it. This means that if the user 51 // with <link rel="prerender"> tags about it. This means that if the user
65 // clicks on a link for a prerendered URL in a different page, the prerender 52 // clicks on a link for a prerendered URL in a different page, the prerender
66 // will not be swapped in. 53 // will not be swapped in.
67 void InformRenderProcessAboutPrerender(const GURL& url, 54 void InformRenderProcessAboutPrerender(const GURL& url,
68 bool is_add, 55 bool is_add,
69 int child_id) { 56 int child_id) {
70 if (child_id < 0) 57 if (child_id < 0)
(...skipping 16 matching lines...) Expand all
87 public: 74 public:
88 virtual PrerenderContents* CreatePrerenderContents( 75 virtual PrerenderContents* CreatePrerenderContents(
89 PrerenderManager* prerender_manager, PrerenderTracker* prerender_tracker, 76 PrerenderManager* prerender_manager, PrerenderTracker* prerender_tracker,
90 Profile* profile, const GURL& url, const content::Referrer& referrer, 77 Profile* profile, const GURL& url, const content::Referrer& referrer,
91 Origin origin, uint8 experiment_id) OVERRIDE { 78 Origin origin, uint8 experiment_id) OVERRIDE {
92 return new PrerenderContents(prerender_manager, prerender_tracker, profile, 79 return new PrerenderContents(prerender_manager, prerender_tracker, profile,
93 url, referrer, origin, experiment_id); 80 url, referrer, origin, experiment_id);
94 } 81 }
95 }; 82 };
96 83
97 struct PrerenderContents::PendingPrerenderInfo {
98 PendingPrerenderInfo(const GURL& url,
99 const content::Referrer& referrer,
100 const gfx::Size& size);
101 const GURL url;
102 const content::Referrer referrer;
103 const gfx::Size size;
104 };
105
106 PrerenderContents::PendingPrerenderInfo::PendingPrerenderInfo(
107 const GURL& url,
108 const content::Referrer& referrer,
109 const gfx::Size& size)
110 : url(url),
111 referrer(referrer),
112 size(size) {
113 }
114
115 // TabContentsDelegateImpl ----------------------------------------------------- 84 // TabContentsDelegateImpl -----------------------------------------------------
116 85
117 class PrerenderContents::TabContentsDelegateImpl 86 class PrerenderContents::TabContentsDelegateImpl
118 : public content::WebContentsDelegate { 87 : public content::WebContentsDelegate {
119 public: 88 public:
120 explicit TabContentsDelegateImpl(PrerenderContents* prerender_contents) : 89 explicit TabContentsDelegateImpl(PrerenderContents* prerender_contents) :
121 prerender_contents_(prerender_contents) { 90 prerender_contents_(prerender_contents) {
122 } 91 }
123 92
124 // content::WebContentsDelegate implementation: 93 // content::WebContentsDelegate implementation:
125 virtual WebContents* OpenURLFromTab(WebContents* source, 94 virtual WebContents* OpenURLFromTab(WebContents* source,
126 const OpenURLParams& params) OVERRIDE { 95 const OpenURLParams& params) OVERRIDE {
127 // |OpenURLFromTab| is typically called when a frame performs a navigation 96 // |OpenURLFromTab| is typically called when a frame performs a navigation
128 // that requires the browser to perform the transition instead of WebKit. 97 // that requires the browser to perform the transition instead of WebKit.
129 // Examples include prerendering a site that redirects to an app URL, 98 // Examples include prerendering a site that redirects to an app URL,
130 // or if --enable-strict-site-isolation is specified and the prerendered 99 // or if --enable-strict-site-isolation is specified and the prerendered
131 // frame redirects to a different origin. 100 // frame redirects to a different origin.
132 // TODO(cbentzel): Consider supporting this if it is a common case during 101 // TODO(cbentzel): Consider supporting this if it is a common case during
133 // prerenders. 102 // prerenders.
134 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); 103 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL);
135 return NULL; 104 return NULL;
136 } 105 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 private: 181 private:
213 typedef std::vector<scoped_refptr<history::HistoryAddPageArgs> > 182 typedef std::vector<scoped_refptr<history::HistoryAddPageArgs> >
214 AddPageVector; 183 AddPageVector;
215 184
216 // Caches pages to be added to the history. 185 // Caches pages to be added to the history.
217 AddPageVector add_page_vector_; 186 AddPageVector add_page_vector_;
218 187
219 PrerenderContents* prerender_contents_; 188 PrerenderContents* prerender_contents_;
220 }; 189 };
221 190
222 void PrerenderContents::AddPendingPrerender(const GURL& url, 191 PrerenderHandle PrerenderContents::AddPendingPrerender(
223 const content::Referrer& referrer, 192 const GURL& url,
224 const gfx::Size& size) { 193 const content::Referrer& referrer,
225 pending_prerender_list_.push_back(PendingPrerenderInfo(url, referrer, size)); 194 const gfx::Size& size) {
195 PrerenderHandleImpl* prerender_handle_impl = new PrerenderHandleImpl;
dominich 2012/06/28 00:34:32 () at the end of the 'new' call to ensure initiali
196 pending_prerender_list_.push_back(
197 PendingPrerenderInfo(prerender_handle_impl, url, referrer, size));
198 return prerender_handle_impl->AsWeakPtr();
226 } 199 }
227 200
228 bool PrerenderContents::IsPendingEntry(const GURL& url) const { 201 bool PrerenderContents::IsPendingEntry(
202 PrerenderHandle prerender_handle) const {
229 for (PendingPrerenderList::const_iterator it = 203 for (PendingPrerenderList::const_iterator it =
230 pending_prerender_list_.begin(); 204 pending_prerender_list_.begin();
231 it != pending_prerender_list_.end(); 205 it != pending_prerender_list_.end();
232 ++it) { 206 ++it) {
233 if (it->url == url) 207 if (it->prerender_handle_impl == prerender_handle)
234 return true; 208 return true;
235 } 209 }
236 return false; 210 return false;
237 } 211 }
238 212
239 void PrerenderContents::StartPendingPrerenders() { 213 void PrerenderContents::StartPendingPrerenders() {
214 SessionStorageNamespace* my_session_storage_namespace = NULL;
dominich 2012/06/28 00:34:32 nit: Drop the my_. Just session_storage_namespace.
215 if (RenderViewHost* render_view_host = GetRenderViewHostMutable()) {
dominich 2012/06/28 00:34:32 why does getting the SessionStorageNamespace requi
216 my_session_storage_namespace =
217 render_view_host->GetSessionStorageNamespace();
218 } else {
219 DCHECK_NE(-1, child_id_)
220 << "No session storage namespace, and not in a test.";
221 }
222
240 PendingPrerenderList pending_prerender_list; 223 PendingPrerenderList pending_prerender_list;
241 pending_prerender_list.swap(pending_prerender_list_); 224 pending_prerender_list.swap(pending_prerender_list_);
242 for (PendingPrerenderList::iterator it = pending_prerender_list.begin(); 225 for (PendingPrerenderList::iterator it = pending_prerender_list.begin();
243 it != pending_prerender_list.end(); 226 it != pending_prerender_list.end();
244 ++it) { 227 ++it) {
245 prerender_manager_->AddPrerenderFromLinkRelPrerender( 228 prerender_manager_->StartPendingPrerender(
246 child_id_, route_id_, it->url, it->referrer, it->size); 229 it->prerender_handle_impl, ORIGIN_LINK_REL_PRERENDER,
dominich 2012/06/28 00:34:32 origin should be stored in the pending struct.
230 child_id_, it->url, it->referrer, it->size,
231 my_session_storage_namespace);
247 } 232 }
248 } 233 }
249 234
235 PrerenderContents::PendingPrerenderInfo::PendingPrerenderInfo(
236 PrerenderHandleImpl* prerender_handle_impl,
dominich 2012/06/28 00:34:32 const PrerenderHandleImpl?
237 const GURL& url,
238 const content::Referrer& referrer,
239 const gfx::Size& size)
240 : prerender_handle_impl(prerender_handle_impl),
241 url(url),
242 referrer(referrer),
243 size(size) {
244 }
245
250 PrerenderContents::PrerenderContents( 246 PrerenderContents::PrerenderContents(
251 PrerenderManager* prerender_manager, 247 PrerenderManager* prerender_manager,
252 PrerenderTracker* prerender_tracker, 248 PrerenderTracker* prerender_tracker,
253 Profile* profile, 249 Profile* profile,
254 const GURL& url, 250 const GURL& url,
255 const content::Referrer& referrer, 251 const content::Referrer& referrer,
256 Origin origin, 252 Origin origin,
257 uint8 experiment_id) 253 uint8 experiment_id)
258 : prerendering_has_started_(false), 254 : prerendering_has_started_(false),
259 prerender_manager_(prerender_manager), 255 prerender_manager_(prerender_manager),
260 prerender_tracker_(prerender_tracker), 256 prerender_tracker_(prerender_tracker),
261 prerender_url_(url), 257 prerender_url_(url),
262 referrer_(referrer), 258 referrer_(referrer),
263 profile_(profile), 259 profile_(profile),
264 page_id_(0), 260 page_id_(0),
261 session_storage_namespace_(NULL),
262 client_count_(1),
265 has_stopped_loading_(false), 263 has_stopped_loading_(false),
266 has_finished_loading_(false), 264 has_finished_loading_(false),
267 final_status_(FINAL_STATUS_MAX), 265 final_status_(FINAL_STATUS_MAX),
268 match_complete_status_(MATCH_COMPLETE_DEFAULT), 266 match_complete_status_(MATCH_COMPLETE_DEFAULT),
269 prerendering_has_been_cancelled_(false), 267 prerendering_has_been_cancelled_(false),
270 child_id_(-1), 268 child_id_(-1),
271 route_id_(-1), 269 route_id_(-1),
272 origin_(origin), 270 origin_(origin),
273 experiment_id_(experiment_id), 271 experiment_id_(experiment_id),
274 creator_child_id_(-1) { 272 creator_child_id_(-1) {
275 DCHECK(prerender_manager != NULL); 273 DCHECK(prerender_manager != NULL);
276 } 274 }
277 275
276 void PrerenderContents::MakeIntoDummyReplacementOf(
dominich 2012/06/28 00:34:32 CloneAsDummy, maybe? Do any of the other members
277 const PrerenderContents* original_prerender_contents) {
278 load_start_time_ = original_prerender_contents->load_start_time_;
279 session_storage_namespace_ =
280 original_prerender_contents->session_storage_namespace_;
281 client_count_ = original_prerender_contents->client_count_;
282 }
283
278 bool PrerenderContents::Init() { 284 bool PrerenderContents::Init() {
279 return AddAliasURL(prerender_url_); 285 return AddAliasURL(prerender_url_);
280 } 286 }
281 287
282 // static 288 // static
283 PrerenderContents::Factory* PrerenderContents::CreateFactory() { 289 PrerenderContents::Factory* PrerenderContents::CreateFactory() {
284 return new PrerenderContentsFactoryImpl(); 290 return new PrerenderContentsFactoryImpl();
285 } 291 }
286 292
287 void PrerenderContents::StartPrerendering( 293 void PrerenderContents::StartPrerendering(
288 int creator_child_id, 294 int creator_child_id,
289 const gfx::Size& size, 295 const gfx::Size& size,
290 content::SessionStorageNamespace* session_storage_namespace, 296 SessionStorageNamespace* session_storage_namespace,
291 bool is_control_group) { 297 bool is_control_group) {
292 DCHECK(profile_ != NULL); 298 DCHECK(profile_ != NULL);
293 DCHECK(!size.IsEmpty()); 299 DCHECK(!size.IsEmpty());
294 DCHECK(!prerendering_has_started_); 300 DCHECK(!prerendering_has_started_);
295 DCHECK(prerender_contents_.get() == NULL); 301 DCHECK(prerender_contents_.get() == NULL);
296 DCHECK_EQ(-1, creator_child_id_); 302 DCHECK_EQ(-1, creator_child_id_);
297 DCHECK(size_.IsEmpty()); 303 DCHECK(size_.IsEmpty());
298 DCHECK_EQ(1U, alias_urls_.size()); 304 DCHECK_EQ(1U, alias_urls_.size());
299 305
300 creator_child_id_ = creator_child_id; 306 creator_child_id_ = creator_child_id;
307 session_storage_namespace_ = session_storage_namespace;
301 size_ = size; 308 size_ = size;
302 309
303 InformRenderProcessAboutPrerender(prerender_url_, true, 310 InformRenderProcessAboutPrerender(prerender_url_, true,
304 creator_child_id_); 311 creator_child_id_);
305 312
313 DCHECK(load_start_time_.is_null());
dominich 2012/06/28 00:34:32 any reason why this moved earlier?
314 load_start_time_ = base::TimeTicks::Now();
315
306 // Everything after this point sets up the WebContents object and associated 316 // Everything after this point sets up the WebContents object and associated
307 // RenderView for the prerender page. Don't do this for members of the 317 // RenderView for the prerender page. Don't do this for members of the
308 // control group. 318 // control group.
309 if (is_control_group) 319 if (is_control_group)
310 return; 320 return;
311 321
312 prerendering_has_started_ = true; 322 prerendering_has_started_ = true;
313 323
314 WebContents* new_contents = CreateWebContents(session_storage_namespace); 324 WebContents* new_contents = CreateWebContents(session_storage_namespace);
315 prerender_contents_.reset(new TabContents(new_contents)); 325 prerender_contents_.reset(new TabContents(new_contents));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // Register to inform new RenderViews that we're prerendering. 361 // Register to inform new RenderViews that we're prerendering.
352 notification_registrar_.Add( 362 notification_registrar_.Add(
353 this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, 363 this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB,
354 content::Source<WebContents>(new_contents)); 364 content::Source<WebContents>(new_contents));
355 365
356 // Register for redirect notifications sourced from |this|. 366 // Register for redirect notifications sourced from |this|.
357 notification_registrar_.Add( 367 notification_registrar_.Add(
358 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, 368 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT,
359 content::Source<WebContents>(GetWebContents())); 369 content::Source<WebContents>(GetWebContents()));
360 370
361 DCHECK(load_start_time_.is_null());
362 load_start_time_ = base::TimeTicks::Now();
363
364 // Transfer over the user agent override. 371 // Transfer over the user agent override.
365 new_contents->SetUserAgentOverride( 372 new_contents->SetUserAgentOverride(
366 prerender_manager_->config().user_agent_override); 373 prerender_manager_->config().user_agent_override);
367 374
368 new_contents->GetController().LoadURLWithUserAgentOverride( 375 new_contents->GetController().LoadURLWithUserAgentOverride(
369 prerender_url_, 376 prerender_url_,
370 referrer_, 377 referrer_,
371 (origin_ == ORIGIN_OMNIBOX ? content::PAGE_TRANSITION_TYPED : 378 (origin_ == ORIGIN_OMNIBOX ? content::PAGE_TRANSITION_TYPED :
372 content::PAGE_TRANSITION_LINK), 379 content::PAGE_TRANSITION_LINK),
373 false, 380 false,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 NOTREACHED() << "Unexpected notification sent."; 494 NOTREACHED() << "Unexpected notification sent.";
488 break; 495 break;
489 } 496 }
490 } 497 }
491 498
492 void PrerenderContents::OnRenderViewHostCreated( 499 void PrerenderContents::OnRenderViewHostCreated(
493 RenderViewHost* new_render_view_host) { 500 RenderViewHost* new_render_view_host) {
494 } 501 }
495 502
496 WebContents* PrerenderContents::CreateWebContents( 503 WebContents* PrerenderContents::CreateWebContents(
497 content::SessionStorageNamespace* session_storage_namespace) { 504 SessionStorageNamespace* session_storage_namespace) {
498 return WebContents::Create(profile_, NULL, MSG_ROUTING_NONE, NULL, 505 return WebContents::Create(profile_, NULL, MSG_ROUTING_NONE, NULL,
499 session_storage_namespace); 506 session_storage_namespace);
500 } 507 }
501 508
502 void PrerenderContents::OnUpdateFaviconURL( 509 void PrerenderContents::OnUpdateFaviconURL(
503 int32 page_id, 510 int32 page_id,
504 const std::vector<FaviconURL>& urls) { 511 const std::vector<FaviconURL>& urls) {
505 VLOG(1) << "PrerenderContents::OnUpdateFaviconURL" << icon_url_; 512 VLOG(1) << "PrerenderContents::OnUpdateFaviconURL" << icon_url_;
506 for (std::vector<FaviconURL>::const_iterator it = urls.begin(); 513 for (std::vector<FaviconURL>::const_iterator it = urls.begin();
507 it != urls.end(); ++it) { 514 it != urls.end(); ++it) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 546
540 void PrerenderContents::AddAliasURLsFromOtherPrerenderContents( 547 void PrerenderContents::AddAliasURLsFromOtherPrerenderContents(
541 PrerenderContents* other_pc) { 548 PrerenderContents* other_pc) {
542 for (std::vector<GURL>::const_iterator it = other_pc->alias_urls_.begin(); 549 for (std::vector<GURL>::const_iterator it = other_pc->alias_urls_.begin();
543 it != other_pc->alias_urls_.end(); 550 it != other_pc->alias_urls_.end();
544 ++it) { 551 ++it) {
545 alias_urls_.push_back(*it); 552 alias_urls_.push_back(*it);
546 } 553 }
547 } 554 }
548 555
549 bool PrerenderContents::MatchesURL(const GURL& url, GURL* matching_url) const { 556 void PrerenderContents::IncrementClientCount() {
550 std::vector<GURL>::const_iterator matching_url_iterator = 557 DCHECK_LT(0, client_count_);
dominich 2012/06/28 00:34:32 this is very confusing. DCHECK_GT(client_count_, 0
551 std::find_if(alias_urls_.begin(), 558 ++client_count_;
552 alias_urls_.end(), 559 }
553 PrerenderURLPredicate(url)); 560
554 if (matching_url_iterator != alias_urls_.end()) { 561 void PrerenderContents::DecrementClientCount() {
555 if (matching_url) 562 if (--client_count_ == 0)
556 *matching_url = *matching_url_iterator; 563 Destroy(FINAL_STATUS_CANCELLED);
557 return true; 564 }
558 } 565
559 return false; 566 bool PrerenderContents::Matches(
567 const GURL& url,
568 const SessionStorageNamespace* session_storage_namespace) {
569 if (session_storage_namespace_ != session_storage_namespace)
570 return false;
571 int match_count = std::count_if(alias_urls_.begin(), alias_urls_.end(),
572 std::bind2nd(std::equal_to<GURL>(), url));
573 return match_count > 0;
dominich 2012/06/28 00:34:32 nit: return std::count_if( alias_urls_.begin()
560 } 574 }
561 575
562 void PrerenderContents::RenderViewGone(base::TerminationStatus status) { 576 void PrerenderContents::RenderViewGone(base::TerminationStatus status) {
563 Destroy(FINAL_STATUS_RENDERER_CRASHED); 577 Destroy(FINAL_STATUS_RENDERER_CRASHED);
564 } 578 }
565 579
566 void PrerenderContents::DidStopLoading() { 580 void PrerenderContents::DidStopLoading() {
567 has_stopped_loading_ = true; 581 has_stopped_loading_ = true;
568 } 582 }
569 583
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 bool PrerenderContents::IsCrossSiteNavigationPending() const { 716 bool PrerenderContents::IsCrossSiteNavigationPending() const {
703 if (!prerender_contents_.get() || !prerender_contents_->web_contents()) 717 if (!prerender_contents_.get() || !prerender_contents_->web_contents())
704 return false; 718 return false;
705 const WebContents* web_contents = prerender_contents_->web_contents(); 719 const WebContents* web_contents = prerender_contents_->web_contents();
706 return (web_contents->GetSiteInstance() != 720 return (web_contents->GetSiteInstance() !=
707 web_contents->GetPendingSiteInstance()); 721 web_contents->GetPendingSiteInstance());
708 } 722 }
709 723
710 724
711 } // namespace prerender 725 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698