Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <functional> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 else | 66 else |
| 67 message = new PrerenderMsg_RemovePrerenderURL(url); | 67 message = new PrerenderMsg_RemovePrerenderURL(url); |
| 68 render_process_host->Send(message); | 68 render_process_host->Send(message); |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| 72 | 72 |
| 73 class PrerenderContentsFactoryImpl : public PrerenderContents::Factory { | 73 class PrerenderContentsFactoryImpl : public PrerenderContents::Factory { |
| 74 public: | 74 public: |
| 75 virtual PrerenderContents* CreatePrerenderContents( | 75 virtual PrerenderContents* CreatePrerenderContents( |
| 76 PrerenderManager* prerender_manager, PrerenderTracker* prerender_tracker, | 76 PrerenderManager* prerender_manager, Profile* profile, |
| 77 Profile* profile, const GURL& url, const content::Referrer& referrer, | 77 const GURL& url, const content::Referrer& referrer, |
| 78 Origin origin, uint8 experiment_id) OVERRIDE { | 78 Origin origin, uint8 experiment_id) OVERRIDE { |
| 79 return new PrerenderContents(prerender_manager, prerender_tracker, profile, | 79 return new PrerenderContents(prerender_manager, profile, |
| 80 url, referrer, origin, experiment_id); | 80 url, referrer, origin, experiment_id); |
| 81 } | 81 } |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 // TabContentsDelegateImpl ----------------------------------------------------- | 84 // TabContentsDelegateImpl ----------------------------------------------------- |
| 85 | 85 |
| 86 class PrerenderContents::TabContentsDelegateImpl | 86 class PrerenderContents::TabContentsDelegateImpl |
| 87 : public content::WebContentsDelegate { | 87 : public content::WebContentsDelegate { |
| 88 public: | 88 public: |
| 89 explicit TabContentsDelegateImpl(PrerenderContents* prerender_contents) : | 89 explicit TabContentsDelegateImpl(PrerenderContents* prerender_contents) : |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 bool user_gesture) OVERRIDE { | 160 bool user_gesture) OVERRIDE { |
| 161 // TODO(mmenke): Consider supporting this if it is a common case during | 161 // TODO(mmenke): Consider supporting this if it is a common case during |
| 162 // prerenders. | 162 // prerenders. |
| 163 prerender_contents_->Destroy(FINAL_STATUS_REGISTER_PROTOCOL_HANDLER); | 163 prerender_contents_->Destroy(FINAL_STATUS_REGISTER_PROTOCOL_HANDLER); |
| 164 } | 164 } |
| 165 | 165 |
| 166 private: | 166 private: |
| 167 PrerenderContents* prerender_contents_; | 167 PrerenderContents* prerender_contents_; |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 PrerenderContents::Observer::Observer() { | |
| 171 } | |
| 172 | |
| 173 PrerenderContents::Observer::~Observer() { | |
| 174 } | |
| 175 | |
| 170 PrerenderContents::PendingPrerenderInfo::PendingPrerenderInfo( | 176 PrerenderContents::PendingPrerenderInfo::PendingPrerenderInfo( |
| 171 base::WeakPtr<PrerenderHandle> weak_prerender_handle, | 177 base::WeakPtr<PrerenderHandle> weak_prerender_handle, |
| 172 Origin origin, | 178 Origin origin, |
| 173 const GURL& url, | 179 const GURL& url, |
| 174 const content::Referrer& referrer, | 180 const content::Referrer& referrer, |
| 175 const gfx::Size& size) : weak_prerender_handle(weak_prerender_handle), | 181 const gfx::Size& size) : weak_prerender_handle(weak_prerender_handle), |
| 176 origin(origin), | 182 origin(origin), |
| 177 url(url), | 183 url(url), |
| 178 referrer(referrer), | 184 referrer(referrer), |
| 179 size(size) { | 185 size(size) { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 195 prerender_contents_->web_contents()->GetController() | 201 prerender_contents_->web_contents()->GetController() |
| 196 .GetDefaultSessionStorageNamespace(); | 202 .GetDefaultSessionStorageNamespace(); |
| 197 } | 203 } |
| 198 prerender_manager_->StartPendingPrerenders( | 204 prerender_manager_->StartPendingPrerenders( |
| 199 child_id_, &pending_prerenders_, session_storage_namespace); | 205 child_id_, &pending_prerenders_, session_storage_namespace); |
| 200 pending_prerenders_.clear(); | 206 pending_prerenders_.clear(); |
| 201 } | 207 } |
| 202 | 208 |
| 203 PrerenderContents::PrerenderContents( | 209 PrerenderContents::PrerenderContents( |
| 204 PrerenderManager* prerender_manager, | 210 PrerenderManager* prerender_manager, |
| 205 PrerenderTracker* prerender_tracker, | |
| 206 Profile* profile, | 211 Profile* profile, |
| 207 const GURL& url, | 212 const GURL& url, |
| 208 const content::Referrer& referrer, | 213 const content::Referrer& referrer, |
| 209 Origin origin, | 214 Origin origin, |
| 210 uint8 experiment_id) | 215 uint8 experiment_id) |
| 211 : prerendering_has_started_(false), | 216 : prerendering_has_started_(false), |
| 212 prerender_manager_(prerender_manager), | 217 prerender_manager_(prerender_manager), |
| 213 prerender_tracker_(prerender_tracker), | |
| 214 prerender_url_(url), | 218 prerender_url_(url), |
| 215 referrer_(referrer), | 219 referrer_(referrer), |
| 216 profile_(profile), | 220 profile_(profile), |
| 217 page_id_(0), | 221 page_id_(0), |
| 218 session_storage_namespace_id_(-1), | 222 session_storage_namespace_id_(-1), |
| 219 has_stopped_loading_(false), | 223 has_stopped_loading_(false), |
| 220 has_finished_loading_(false), | 224 has_finished_loading_(false), |
| 221 final_status_(FINAL_STATUS_MAX), | 225 final_status_(FINAL_STATUS_MAX), |
| 222 match_complete_status_(MATCH_COMPLETE_DEFAULT), | 226 match_complete_status_(MATCH_COMPLETE_DEFAULT), |
| 223 prerendering_has_been_cancelled_(false), | 227 prerendering_has_been_cancelled_(false), |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 253 } | 257 } |
| 254 | 258 |
| 255 // static | 259 // static |
| 256 PrerenderContents::Factory* PrerenderContents::CreateFactory() { | 260 PrerenderContents::Factory* PrerenderContents::CreateFactory() { |
| 257 return new PrerenderContentsFactoryImpl(); | 261 return new PrerenderContentsFactoryImpl(); |
| 258 } | 262 } |
| 259 | 263 |
| 260 void PrerenderContents::StartPrerendering( | 264 void PrerenderContents::StartPrerendering( |
| 261 int creator_child_id, | 265 int creator_child_id, |
| 262 const gfx::Size& size, | 266 const gfx::Size& size, |
| 263 SessionStorageNamespace* session_storage_namespace, | 267 SessionStorageNamespace* session_storage_namespace) { |
| 264 bool is_control_group) { | |
| 265 DCHECK(profile_ != NULL); | 268 DCHECK(profile_ != NULL); |
| 266 DCHECK(!size.IsEmpty()); | 269 DCHECK(!size.IsEmpty()); |
| 267 DCHECK(!prerendering_has_started_); | 270 DCHECK(!prerendering_has_started_); |
| 268 DCHECK(prerender_contents_.get() == NULL); | 271 DCHECK(prerender_contents_.get() == NULL); |
| 269 DCHECK_EQ(-1, creator_child_id_); | 272 DCHECK_EQ(-1, creator_child_id_); |
| 270 DCHECK(size_.IsEmpty()); | 273 DCHECK(size_.IsEmpty()); |
| 271 DCHECK_EQ(1U, alias_urls_.size()); | 274 DCHECK_EQ(1U, alias_urls_.size()); |
| 272 | 275 |
| 273 creator_child_id_ = creator_child_id; | 276 creator_child_id_ = creator_child_id; |
| 274 session_storage_namespace_id_ = session_storage_namespace->id(); | 277 session_storage_namespace_id_ = session_storage_namespace->id(); |
| 275 size_ = size; | 278 size_ = size; |
| 276 | 279 |
| 277 InformRenderProcessAboutPrerender(prerender_url_, true, | 280 InformRenderProcessAboutPrerender(prerender_url_, true, |
| 278 creator_child_id_); | 281 creator_child_id_); |
| 279 | 282 |
| 280 DCHECK(load_start_time_.is_null()); | 283 DCHECK(load_start_time_.is_null()); |
| 281 load_start_time_ = base::TimeTicks::Now(); | 284 load_start_time_ = base::TimeTicks::Now(); |
| 282 | 285 |
| 283 // Everything after this point sets up the WebContents object and associated | 286 // Everything after this point sets up the WebContents object and associated |
| 284 // RenderView for the prerender page. Don't do this for members of the | 287 // RenderView for the prerender page. Don't do this for members of the |
| 285 // control group. | 288 // control group. |
| 286 if (is_control_group) | 289 if (prerender_manager_->IsControlGroup(experiment_id())) |
| 287 return; | 290 return; |
| 288 | 291 |
| 289 prerendering_has_started_ = true; | 292 prerendering_has_started_ = true; |
| 290 | 293 |
| 291 WebContents* new_contents = CreateWebContents(session_storage_namespace); | 294 WebContents* new_contents = CreateWebContents(session_storage_namespace); |
| 292 prerender_contents_.reset( | 295 prerender_contents_.reset( |
| 293 TabContents::Factory::CreateTabContents(new_contents)); | 296 TabContents::Factory::CreateTabContents(new_contents)); |
| 294 content::WebContentsObserver::Observe(new_contents); | 297 content::WebContentsObserver::Observe(new_contents); |
| 295 | 298 |
| 296 tab_contents_delegate_.reset(new TabContentsDelegateImpl(this)); | 299 tab_contents_delegate_.reset(new TabContentsDelegateImpl(this)); |
| 297 new_contents->SetDelegate(tab_contents_delegate_.get()); | 300 new_contents->SetDelegate(tab_contents_delegate_.get()); |
| 298 // Set the size of the prerender WebContents. | 301 // Set the size of the prerender WebContents. |
| 299 prerender_contents_->web_contents()->GetView()->SizeContents(size_); | 302 prerender_contents_->web_contents()->GetView()->SizeContents(size_); |
| 300 | 303 |
| 301 // Register as an observer of the RenderViewHost so we get messages. | 304 // Register as an observer of the RenderViewHost so we get messages. |
| 302 render_view_host_observer_.reset( | 305 render_view_host_observer_.reset( |
| 303 new PrerenderRenderViewHostObserver(this, GetRenderViewHostMutable())); | 306 new PrerenderRenderViewHostObserver(this, GetRenderViewHostMutable())); |
| 304 | 307 |
| 305 child_id_ = GetRenderViewHost()->GetProcess()->GetID(); | 308 child_id_ = GetRenderViewHost()->GetProcess()->GetID(); |
| 306 route_id_ = GetRenderViewHost()->GetRoutingID(); | 309 route_id_ = GetRenderViewHost()->GetRoutingID(); |
| 307 | 310 |
| 308 // Register this with the ResourceDispatcherHost as a prerender | 311 // Register this with the ResourceDispatcherHost as a prerender |
| 309 // RenderViewHost. This must be done before the Navigate message to catch all | 312 // RenderViewHost. This must be done before the Navigate message to catch all |
| 310 // resource requests, but as it is on the same thread as the Navigate message | 313 // resource requests, but as it is on the same thread as the Navigate message |
| 311 // (IO) there is no race condition. | 314 // (IO) there is no race condition. |
| 312 prerender_tracker_->OnPrerenderingStarted( | 315 AddObserver(prerender_manager()->prerender_tracker()); |
| 313 child_id_, | 316 NotifyPrerenderStart(); |
| 314 route_id_, | |
| 315 prerender_manager_); | |
| 316 | 317 |
| 317 // Close ourselves when the application is shutting down. | 318 // Close ourselves when the application is shutting down. |
| 318 notification_registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, | 319 notification_registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
| 319 content::NotificationService::AllSources()); | 320 content::NotificationService::AllSources()); |
| 320 | 321 |
| 321 // Register for our parent profile to shutdown, so we can shut ourselves down | 322 // Register for our parent profile to shutdown, so we can shut ourselves down |
| 322 // as well (should only be called for OTR profiles, as we should receive | 323 // as well (should only be called for OTR profiles, as we should receive |
| 323 // APP_TERMINATING before non-OTR profiles are destroyed). | 324 // APP_TERMINATING before non-OTR profiles are destroyed). |
| 324 // TODO(tburkard): figure out if this is needed. | 325 // TODO(tburkard): figure out if this is needed. |
| 325 notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, | 326 notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 return child_id_ != -1; | 359 return child_id_ != -1; |
| 359 } | 360 } |
| 360 | 361 |
| 361 bool PrerenderContents::GetRouteId(int* route_id) const { | 362 bool PrerenderContents::GetRouteId(int* route_id) const { |
| 362 CHECK(route_id); | 363 CHECK(route_id); |
| 363 DCHECK_GE(route_id_, -1); | 364 DCHECK_GE(route_id_, -1); |
| 364 *route_id = route_id_; | 365 *route_id = route_id_; |
| 365 return route_id_ != -1; | 366 return route_id_ != -1; |
| 366 } | 367 } |
| 367 | 368 |
| 368 void PrerenderContents::set_final_status(FinalStatus final_status) { | 369 void PrerenderContents::SetFinalStatus(FinalStatus final_status) { |
| 369 DCHECK(final_status >= FINAL_STATUS_USED && final_status < FINAL_STATUS_MAX); | 370 DCHECK(final_status >= FINAL_STATUS_USED && final_status < FINAL_STATUS_MAX); |
| 370 DCHECK(final_status_ == FINAL_STATUS_MAX); | 371 DCHECK(final_status_ == FINAL_STATUS_MAX); |
| 371 | 372 |
| 372 final_status_ = final_status; | 373 final_status_ = final_status; |
| 374 | |
| 375 if (!prerender_manager_->IsControlGroup(experiment_id()) && | |
| 376 prerendering_has_started()) | |
| 377 NotifyPrerenderStop(); | |
|
mmenke
2012/12/07 19:21:17
nit: Add braces.
gavinp
2012/12/08 17:27:48
Done.
| |
| 373 } | 378 } |
| 374 | 379 |
| 375 PrerenderContents::~PrerenderContents() { | 380 PrerenderContents::~PrerenderContents() { |
| 376 DCHECK(final_status_ != FINAL_STATUS_MAX); | 381 DCHECK_NE(FINAL_STATUS_MAX, final_status_); |
| 377 DCHECK(prerendering_has_been_cancelled_ || | 382 DCHECK( |
| 378 final_status_ == FINAL_STATUS_USED); | 383 prerendering_has_been_cancelled_ || final_status_ == FINAL_STATUS_USED); |
| 379 DCHECK(origin_ != ORIGIN_MAX); | 384 DCHECK_NE(ORIGIN_MAX, origin_); |
| 380 | 385 |
| 381 prerender_manager_->RecordFinalStatusWithMatchCompleteStatus( | 386 prerender_manager_->RecordFinalStatusWithMatchCompleteStatus( |
| 382 origin_, | 387 origin_, experiment_id_, match_complete_status_, final_status_); |
|
mmenke
2012/12/07 19:21:17
nit: experiment_id_ is used here, experiment_id()
gavinp
2012/12/08 17:27:48
Done. I moved the rest of the member references th
| |
| 383 experiment_id_, | |
| 384 match_complete_status_, | |
| 385 final_status_); | |
| 386 | 388 |
| 387 if (child_id_ != -1 && route_id_ != -1) { | 389 if (child_id_ != -1 && route_id_ != -1) { |
| 388 prerender_tracker_->OnPrerenderingFinished(child_id_, route_id_); | |
| 389 for (std::vector<GURL>::const_iterator it = alias_urls_.begin(); | 390 for (std::vector<GURL>::const_iterator it = alias_urls_.begin(); |
| 390 it != alias_urls_.end(); | 391 it != alias_urls_.end(); |
| 391 ++it) { | 392 ++it) { |
| 392 InformRenderProcessAboutPrerender(*it, false, creator_child_id_); | 393 InformRenderProcessAboutPrerender(*it, false, creator_child_id_); |
| 393 } | 394 } |
| 394 } | 395 } |
| 395 | 396 |
| 396 // If we still have a WebContents, clean up anything we need to and then | 397 // If we still have a WebContents, clean up anything we need to and then |
| 397 // destroy it. | 398 // destroy it. |
| 398 if (prerender_contents_.get()) | 399 if (prerender_contents_.get()) |
| 399 delete ReleasePrerenderContents(); | 400 delete ReleasePrerenderContents(); |
| 400 } | 401 } |
| 401 | 402 |
| 403 void PrerenderContents::AddObserver(Observer* observer) { | |
| 404 DCHECK_EQ(FINAL_STATUS_MAX, final_status_); | |
| 405 observer_list_.AddObserver(observer); | |
| 406 } | |
| 407 | |
| 402 void PrerenderContents::Observe(int type, | 408 void PrerenderContents::Observe(int type, |
| 403 const content::NotificationSource& source, | 409 const content::NotificationSource& source, |
| 404 const content::NotificationDetails& details) { | 410 const content::NotificationDetails& details) { |
| 405 switch (type) { | 411 switch (type) { |
| 406 case chrome::NOTIFICATION_PROFILE_DESTROYED: | 412 case chrome::NOTIFICATION_PROFILE_DESTROYED: |
| 407 Destroy(FINAL_STATUS_PROFILE_DESTROYED); | 413 Destroy(FINAL_STATUS_PROFILE_DESTROYED); |
| 408 return; | 414 return; |
| 409 | 415 |
| 410 case chrome::NOTIFICATION_APP_TERMINATING: | 416 case chrome::NOTIFICATION_APP_TERMINATING: |
| 411 Destroy(FINAL_STATUS_APP_TERMINATING); | 417 Destroy(FINAL_STATUS_APP_TERMINATING); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 476 WebContents* PrerenderContents::CreateWebContents( | 482 WebContents* PrerenderContents::CreateWebContents( |
| 477 SessionStorageNamespace* session_storage_namespace) { | 483 SessionStorageNamespace* session_storage_namespace) { |
| 478 // TODO(ajwong): Remove the temporary map once prerendering is aware of | 484 // TODO(ajwong): Remove the temporary map once prerendering is aware of |
| 479 // multiple session storage namespaces per tab. | 485 // multiple session storage namespaces per tab. |
| 480 content::SessionStorageNamespaceMap session_storage_namespace_map; | 486 content::SessionStorageNamespaceMap session_storage_namespace_map; |
| 481 session_storage_namespace_map[""] = session_storage_namespace; | 487 session_storage_namespace_map[""] = session_storage_namespace; |
| 482 return WebContents::CreateWithSessionStorage( | 488 return WebContents::CreateWithSessionStorage( |
| 483 profile_, NULL, MSG_ROUTING_NONE, NULL, session_storage_namespace_map); | 489 profile_, NULL, MSG_ROUTING_NONE, NULL, session_storage_namespace_map); |
| 484 } | 490 } |
| 485 | 491 |
| 492 void PrerenderContents::NotifyPrerenderStart() { | |
| 493 DCHECK_EQ(FINAL_STATUS_MAX, final_status_); | |
| 494 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderStart(this)); | |
| 495 } | |
| 496 | |
| 497 void PrerenderContents::NotifyPrerenderStop() { | |
| 498 DCHECK_NE(FINAL_STATUS_MAX, final_status_); | |
| 499 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderStop(this)); | |
| 500 observer_list_.Clear(); | |
| 501 } | |
| 502 | |
| 486 void PrerenderContents::DidUpdateFaviconURL( | 503 void PrerenderContents::DidUpdateFaviconURL( |
| 487 int32 page_id, | 504 int32 page_id, |
| 488 const std::vector<content::FaviconURL>& urls) { | 505 const std::vector<content::FaviconURL>& urls) { |
| 489 VLOG(1) << "PrerenderContents::OnUpdateFaviconURL" << icon_url_; | 506 VLOG(1) << "PrerenderContents::OnUpdateFaviconURL" << icon_url_; |
| 490 for (std::vector<content::FaviconURL>::const_iterator it = urls.begin(); | 507 for (std::vector<content::FaviconURL>::const_iterator it = urls.begin(); |
| 491 it != urls.end(); ++it) { | 508 it != urls.end(); ++it) { |
| 492 if (it->icon_type == content::FaviconURL::FAVICON) { | 509 if (it->icon_type == content::FaviconURL::FAVICON) { |
| 493 icon_url_ = it->icon_url; | 510 icon_url_ = it->icon_url; |
| 494 VLOG(1) << icon_url_; | 511 VLOG(1) << icon_url_; |
| 495 return; | 512 return; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 572 | 589 |
| 573 void PrerenderContents::Destroy(FinalStatus final_status) { | 590 void PrerenderContents::Destroy(FinalStatus final_status) { |
| 574 if (prerendering_has_been_cancelled_) | 591 if (prerendering_has_been_cancelled_) |
| 575 return; | 592 return; |
| 576 | 593 |
| 577 if (child_id_ != -1 && route_id_ != -1) { | 594 if (child_id_ != -1 && route_id_ != -1) { |
| 578 // Cancel the prerender in the PrerenderTracker. This is needed | 595 // Cancel the prerender in the PrerenderTracker. This is needed |
| 579 // because destroy may be called directly from the UI thread without calling | 596 // because destroy may be called directly from the UI thread without calling |
| 580 // TryCancel(). This is difficult to completely avoid, since prerendering | 597 // TryCancel(). This is difficult to completely avoid, since prerendering |
| 581 // can be cancelled before a RenderView is created. | 598 // can be cancelled before a RenderView is created. |
| 582 bool is_cancelled = prerender_tracker_->TryCancel( | 599 bool is_cancelled = prerender_manager()->prerender_tracker()->TryCancel( |
| 583 child_id_, route_id_, final_status); | 600 child_id_, route_id_, final_status); |
| 584 CHECK(is_cancelled); | 601 CHECK(is_cancelled); |
| 585 | 602 |
| 586 // A different final status may have been set already from another thread. | 603 // A different final status may have been set already from another thread. |
| 587 // If so, use it instead. | 604 // If so, use it instead. |
| 588 if (!prerender_tracker_->GetFinalStatus(child_id_, route_id_, | 605 if (!prerender_manager()->prerender_tracker()-> |
| 589 &final_status)) { | 606 GetFinalStatus(child_id_, route_id_, &final_status)) { |
| 590 NOTREACHED(); | 607 NOTREACHED(); |
| 591 } | 608 } |
| 592 } | 609 } |
| 593 set_final_status(final_status); | 610 SetFinalStatus(final_status); |
| 594 | 611 |
| 595 prerendering_has_been_cancelled_ = true; | 612 prerendering_has_been_cancelled_ = true; |
| 596 prerender_manager_->AddToHistory(this); | 613 prerender_manager_->AddToHistory(this); |
| 597 prerender_manager_->MoveEntryToPendingDelete(this, final_status); | 614 prerender_manager_->MoveEntryToPendingDelete(this, final_status); |
| 598 | 615 |
| 599 // We may destroy the PrerenderContents before we have initialized the | 616 // We may destroy the PrerenderContents before we have initialized the |
| 600 // RenderViewHost. Otherwise set the Observer's PrerenderContents to NULL to | 617 // RenderViewHost. Otherwise set the Observer's PrerenderContents to NULL to |
| 601 // avoid any more messages being sent. | 618 // avoid any more messages being sent. |
| 602 if (render_view_host_observer_) | 619 if (render_view_host_observer_) |
| 603 render_view_host_observer_->set_prerender_contents(NULL); | 620 render_view_host_observer_->set_prerender_contents(NULL); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 684 bool PrerenderContents::IsCrossSiteNavigationPending() const { | 701 bool PrerenderContents::IsCrossSiteNavigationPending() const { |
| 685 if (!prerender_contents_.get() || !prerender_contents_->web_contents()) | 702 if (!prerender_contents_.get() || !prerender_contents_->web_contents()) |
| 686 return false; | 703 return false; |
| 687 const WebContents* web_contents = prerender_contents_->web_contents(); | 704 const WebContents* web_contents = prerender_contents_->web_contents(); |
| 688 return (web_contents->GetSiteInstance() != | 705 return (web_contents->GetSiteInstance() != |
| 689 web_contents->GetPendingSiteInstance()); | 706 web_contents->GetPendingSiteInstance()); |
| 690 } | 707 } |
| 691 | 708 |
| 692 | 709 |
| 693 } // namespace prerender | 710 } // namespace prerender |
| OLD | NEW |