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 "content/browser/tab_contents/render_view_host_manager.h" | 5 #include "content/browser/tab_contents/render_view_host_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "content/browser/debugger/devtools_manager_impl.h" | 11 #include "content/browser/debugger/devtools_manager_impl.h" |
12 #include "content/browser/renderer_host/render_view_host.h" | 12 #include "content/browser/renderer_host/render_view_host.h" |
13 #include "content/browser/renderer_host/render_view_host_factory.h" | 13 #include "content/browser/renderer_host/render_view_host_factory.h" |
14 #include "content/browser/renderer_host/render_widget_host_view.h" | 14 #include "content/browser/renderer_host/render_widget_host_view.h" |
15 #include "content/browser/site_instance.h" | 15 #include "content/browser/site_instance_impl.h" |
16 #include "content/browser/tab_contents/navigation_controller_impl.h" | 16 #include "content/browser/tab_contents/navigation_controller_impl.h" |
17 #include "content/browser/tab_contents/navigation_entry_impl.h" | 17 #include "content/browser/tab_contents/navigation_entry_impl.h" |
18 #include "content/browser/webui/web_ui_impl.h" | 18 #include "content/browser/webui/web_ui_impl.h" |
19 #include "content/common/view_messages.h" | 19 #include "content/common/view_messages.h" |
20 #include "content/public/browser/content_browser_client.h" | 20 #include "content/public/browser/content_browser_client.h" |
21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
22 #include "content/public/browser/notification_types.h" | 22 #include "content/public/browser/notification_types.h" |
23 #include "content/public/browser/render_view_host_delegate.h" | 23 #include "content/public/browser/render_view_host_delegate.h" |
24 #include "content/public/browser/web_contents_view.h" | 24 #include "content/public/browser/web_contents_view.h" |
25 #include "content/public/browser/web_ui_controller.h" | 25 #include "content/public/browser/web_ui_controller.h" |
(...skipping 27 matching lines...) Expand all Loading... |
53 | 53 |
54 // Shut down any swapped out RenderViewHosts. | 54 // Shut down any swapped out RenderViewHosts. |
55 for (RenderViewHostMap::iterator iter = swapped_out_hosts_.begin(); | 55 for (RenderViewHostMap::iterator iter = swapped_out_hosts_.begin(); |
56 iter != swapped_out_hosts_.end(); | 56 iter != swapped_out_hosts_.end(); |
57 ++iter) { | 57 ++iter) { |
58 iter->second->Shutdown(); | 58 iter->second->Shutdown(); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 void RenderViewHostManager::Init(content::BrowserContext* browser_context, | 62 void RenderViewHostManager::Init(content::BrowserContext* browser_context, |
63 SiteInstance* site_instance, | 63 content::SiteInstance* site_instance, |
64 int routing_id) { | 64 int routing_id) { |
65 // Create a RenderViewHost, once we have an instance. It is important to | 65 // Create a RenderViewHost, once we have an instance. It is important to |
66 // immediately give this SiteInstance to a RenderViewHost so that it is | 66 // immediately give this SiteInstance to a RenderViewHost so that it is |
67 // ref counted. | 67 // ref counted. |
68 if (!site_instance) | 68 if (!site_instance) |
69 site_instance = SiteInstance::CreateSiteInstance(browser_context); | 69 site_instance = content::SiteInstance::CreateSiteInstance( |
| 70 browser_context); |
70 render_view_host_ = RenderViewHostFactory::Create( | 71 render_view_host_ = RenderViewHostFactory::Create( |
71 site_instance, render_view_delegate_, routing_id, delegate_-> | 72 site_instance, render_view_delegate_, routing_id, delegate_-> |
72 GetControllerForRenderManager().GetSessionStorageNamespace()); | 73 GetControllerForRenderManager().GetSessionStorageNamespace()); |
73 | 74 |
74 // Keep track of renderer processes as they start to shut down. | 75 // Keep track of renderer processes as they start to shut down. |
75 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSING, | 76 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSING, |
76 content::NotificationService::AllSources()); | 77 content::NotificationService::AllSources()); |
77 } | 78 } |
78 | 79 |
79 RenderWidgetHostView* RenderViewHostManager::GetRenderWidgetHostView() const { | 80 RenderWidgetHostView* RenderViewHostManager::GetRenderWidgetHostView() const { |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 const NavigationEntryImpl* new_entry) const { | 339 const NavigationEntryImpl* new_entry) const { |
339 DCHECK(new_entry); | 340 DCHECK(new_entry); |
340 | 341 |
341 // Check for reasons to swap processes even if we are in a process model that | 342 // Check for reasons to swap processes even if we are in a process model that |
342 // doesn't usually swap (e.g., process-per-tab). | 343 // doesn't usually swap (e.g., process-per-tab). |
343 | 344 |
344 // For security, we should transition between processes when one is a Web UI | 345 // For security, we should transition between processes when one is a Web UI |
345 // page and one isn't. If there's no cur_entry, check the current RVH's | 346 // page and one isn't. If there's no cur_entry, check the current RVH's |
346 // site, which might already be committed to a Web UI URL (such as the NTP). | 347 // site, which might already be committed to a Web UI URL (such as the NTP). |
347 const GURL& current_url = (cur_entry) ? cur_entry->GetURL() : | 348 const GURL& current_url = (cur_entry) ? cur_entry->GetURL() : |
348 render_view_host_->site_instance()->site(); | 349 render_view_host_->site_instance()->GetSite(); |
349 content::BrowserContext* browser_context = | 350 content::BrowserContext* browser_context = |
350 delegate_->GetControllerForRenderManager().GetBrowserContext(); | 351 delegate_->GetControllerForRenderManager().GetBrowserContext(); |
351 const content::WebUIFactory* web_ui_factory = | 352 const content::WebUIFactory* web_ui_factory = |
352 content::GetContentClient()->browser()->GetWebUIFactory(); | 353 content::GetContentClient()->browser()->GetWebUIFactory(); |
353 if (web_ui_factory->UseWebUIForURL(browser_context, current_url)) { | 354 if (web_ui_factory->UseWebUIForURL(browser_context, current_url)) { |
354 // Force swap if it's not an acceptable URL for Web UI. | 355 // Force swap if it's not an acceptable URL for Web UI. |
355 if (!web_ui_factory->IsURLAcceptableForWebUI(browser_context, | 356 if (!web_ui_factory->IsURLAcceptableForWebUI(browser_context, |
356 new_entry->GetURL())) | 357 new_entry->GetURL())) |
357 return true; | 358 return true; |
358 } else { | 359 } else { |
(...skipping 13 matching lines...) Expand all Loading... |
372 // We can't switch a RenderView between view source and non-view source mode | 373 // We can't switch a RenderView between view source and non-view source mode |
373 // without screwing up the session history sometimes (when navigating between | 374 // without screwing up the session history sometimes (when navigating between |
374 // "view-source:http://foo.com/" and "http://foo.com/", WebKit doesn't treat | 375 // "view-source:http://foo.com/" and "http://foo.com/", WebKit doesn't treat |
375 // it as a new navigation). So require a view switch. | 376 // it as a new navigation). So require a view switch. |
376 if (cur_entry->IsViewSourceMode() != new_entry->IsViewSourceMode()) | 377 if (cur_entry->IsViewSourceMode() != new_entry->IsViewSourceMode()) |
377 return true; | 378 return true; |
378 | 379 |
379 return false; | 380 return false; |
380 } | 381 } |
381 | 382 |
382 SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry( | 383 content::SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry( |
383 const NavigationEntryImpl& entry, | 384 const NavigationEntryImpl& entry, |
384 SiteInstance* curr_instance) { | 385 content::SiteInstance* curr_instance) { |
385 // NOTE: This is only called when ShouldTransitionCrossSite is true. | 386 // NOTE: This is only called when ShouldTransitionCrossSite is true. |
386 | 387 |
387 const GURL& dest_url = entry.GetURL(); | 388 const GURL& dest_url = entry.GetURL(); |
388 NavigationControllerImpl& controller = | 389 NavigationControllerImpl& controller = |
389 delegate_->GetControllerForRenderManager(); | 390 delegate_->GetControllerForRenderManager(); |
390 content::BrowserContext* browser_context = controller.GetBrowserContext(); | 391 content::BrowserContext* browser_context = controller.GetBrowserContext(); |
391 | 392 |
392 // If the entry has an instance already we should use it. | 393 // If the entry has an instance already we should use it. |
393 if (entry.site_instance()) | 394 if (entry.site_instance()) |
394 return entry.site_instance(); | 395 return entry.site_instance(); |
395 | 396 |
396 // (UGLY) HEURISTIC, process-per-site only: | 397 // (UGLY) HEURISTIC, process-per-site only: |
397 // | 398 // |
398 // If this navigation is generated, then it probably corresponds to a search | 399 // If this navigation is generated, then it probably corresponds to a search |
399 // query. Given that search results typically lead to users navigating to | 400 // query. Given that search results typically lead to users navigating to |
400 // other sites, we don't really want to use the search engine hostname to | 401 // other sites, we don't really want to use the search engine hostname to |
401 // determine the site instance for this navigation. | 402 // determine the site instance for this navigation. |
402 // | 403 // |
403 // NOTE: This can be removed once we have a way to transition between | 404 // NOTE: This can be removed once we have a way to transition between |
404 // RenderViews in response to a link click. | 405 // RenderViews in response to a link click. |
405 // | 406 // |
406 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerSite) && | 407 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerSite) && |
407 entry.GetTransitionType() == content::PAGE_TRANSITION_GENERATED) | 408 entry.GetTransitionType() == content::PAGE_TRANSITION_GENERATED) |
408 return curr_instance; | 409 return curr_instance; |
409 | 410 |
410 // If we haven't used our SiteInstance (and thus RVH) yet, then we can use it | 411 // If we haven't used our SiteInstance (and thus RVH) yet, then we can use it |
411 // for this entry. We won't commit the SiteInstance to this site until the | 412 // for this entry. We won't commit the SiteInstance to this site until the |
412 // navigation commits (in DidNavigate), unless the navigation entry was | 413 // navigation commits (in DidNavigate), unless the navigation entry was |
413 // restored or it's a Web UI as described below. | 414 // restored or it's a Web UI as described below. |
414 if (!curr_instance->has_site()) { | 415 if (!curr_instance->HasSite()) { |
415 // If we've already created a SiteInstance for our destination, we don't | 416 // If we've already created a SiteInstance for our destination, we don't |
416 // want to use this unused SiteInstance; use the existing one. (We don't | 417 // want to use this unused SiteInstance; use the existing one. (We don't |
417 // do this check if the curr_instance has a site, because for now, we want | 418 // do this check if the curr_instance has a site, because for now, we want |
418 // to compare against the current URL and not the SiteInstance's site. In | 419 // to compare against the current URL and not the SiteInstance's site. In |
419 // this case, there is no current URL, so comparing against the site is ok. | 420 // this case, there is no current URL, so comparing against the site is ok. |
420 // See additional comments below.) | 421 // See additional comments below.) |
421 if (curr_instance->HasRelatedSiteInstance(dest_url)) | 422 if (curr_instance->HasRelatedSiteInstance(dest_url)) |
422 return curr_instance->GetRelatedSiteInstance(dest_url); | 423 return curr_instance->GetRelatedSiteInstance(dest_url); |
423 | 424 |
424 // For extensions, Web UI URLs (such as the new tab page), and apps we do | 425 // For extensions, Web UI URLs (such as the new tab page), and apps we do |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 // has a site), then we must have been opened from another tab. We want | 463 // has a site), then we must have been opened from another tab. We want |
463 // to compare against the URL of the page that opened us, but we can't | 464 // to compare against the URL of the page that opened us, but we can't |
464 // get to it directly. The best we can do is check against the site of | 465 // get to it directly. The best we can do is check against the site of |
465 // the SiteInstance. This will be correct when we intercept links and | 466 // the SiteInstance. This will be correct when we intercept links and |
466 // script-based navigations, but for now, it could place some pages in a | 467 // script-based navigations, but for now, it could place some pages in a |
467 // new process unnecessarily. We should only hit this case if a page tries | 468 // new process unnecessarily. We should only hit this case if a page tries |
468 // to open a new tab to an interstitial-inducing URL, and then navigates | 469 // to open a new tab to an interstitial-inducing URL, and then navigates |
469 // the page to a different same-site URL. (This seems very unlikely in | 470 // the page to a different same-site URL. (This seems very unlikely in |
470 // practice.) | 471 // practice.) |
471 const GURL& current_url = (curr_entry) ? curr_entry->GetURL() : | 472 const GURL& current_url = (curr_entry) ? curr_entry->GetURL() : |
472 curr_instance->site(); | 473 curr_instance->GetSite(); |
473 | 474 |
474 // Use the current SiteInstance for same site navigations, as long as the | 475 // Use the current SiteInstance for same site navigations, as long as the |
475 // process type is correct. (The URL may have been installed as an app since | 476 // process type is correct. (The URL may have been installed as an app since |
476 // the last time we visited it.) | 477 // the last time we visited it.) |
477 if (SiteInstance::IsSameWebSite(browser_context, current_url, dest_url) && | 478 if (content::SiteInstance::IsSameWebSite( |
| 479 browser_context, current_url, dest_url) && |
478 !curr_instance->HasWrongProcessForURL(dest_url)) { | 480 !curr_instance->HasWrongProcessForURL(dest_url)) { |
479 return curr_instance; | 481 return curr_instance; |
480 } else if (ShouldSwapProcessesForNavigation(curr_entry, &entry)) { | 482 } else if (ShouldSwapProcessesForNavigation(curr_entry, &entry)) { |
481 // When we're swapping, we need to force the site instance AND browsing | 483 // When we're swapping, we need to force the site instance AND browsing |
482 // instance to be different ones. This addresses special cases where we use | 484 // instance to be different ones. This addresses special cases where we use |
483 // a single BrowsingInstance for all pages of a certain type (e.g., New Tab | 485 // a single BrowsingInstance for all pages of a certain type (e.g., New Tab |
484 // Pages), keeping them in the same process. When you navigate away from | 486 // Pages), keeping them in the same process. When you navigate away from |
485 // that page, we want to explicity ignore that BrowsingInstance and group | 487 // that page, we want to explicity ignore that BrowsingInstance and group |
486 // this page into the appropriate SiteInstance for its URL. | 488 // this page into the appropriate SiteInstance for its URL. |
487 return SiteInstance::CreateSiteInstanceForURL(browser_context, dest_url); | 489 return content::SiteInstance::CreateSiteInstanceForURL(browser_context, |
| 490 dest_url); |
488 } else { | 491 } else { |
489 // Start the new renderer in a new SiteInstance, but in the current | 492 // Start the new renderer in a new SiteInstance, but in the current |
490 // BrowsingInstance. It is important to immediately give this new | 493 // BrowsingInstance. It is important to immediately give this new |
491 // SiteInstance to a RenderViewHost (if it is different than our current | 494 // SiteInstance to a RenderViewHost (if it is different than our current |
492 // SiteInstance), so that it is ref counted. This will happen in | 495 // SiteInstance), so that it is ref counted. This will happen in |
493 // CreatePendingRenderView. | 496 // CreatePendingRenderView. |
494 return curr_instance->GetRelatedSiteInstance(dest_url); | 497 return curr_instance->GetRelatedSiteInstance(dest_url); |
495 } | 498 } |
496 } | 499 } |
497 | 500 |
498 bool RenderViewHostManager::CreatePendingRenderView( | 501 bool RenderViewHostManager::CreatePendingRenderView( |
499 const NavigationEntryImpl& entry, SiteInstance* instance) { | 502 const NavigationEntryImpl& entry, content::SiteInstance* instance) { |
500 NavigationEntry* curr_entry = | 503 NavigationEntry* curr_entry = |
501 delegate_->GetControllerForRenderManager().GetLastCommittedEntry(); | 504 delegate_->GetControllerForRenderManager().GetLastCommittedEntry(); |
502 if (curr_entry) { | 505 if (curr_entry) { |
503 DCHECK(!curr_entry->GetContentState().empty()); | 506 DCHECK(!curr_entry->GetContentState().empty()); |
504 // TODO(creis): Should send a message to the RenderView to let it know | 507 // TODO(creis): Should send a message to the RenderView to let it know |
505 // we're about to switch away, so that it sends an UpdateState message. | 508 // we're about to switch away, so that it sends an UpdateState message. |
506 } | 509 } |
507 | 510 |
508 // Check if we've already created an RVH for this SiteInstance. | 511 // Check if we've already created an RVH for this SiteInstance. |
509 CHECK(instance); | 512 CHECK(instance); |
510 RenderViewHostMap::iterator iter = | 513 RenderViewHostMap::iterator iter = |
511 swapped_out_hosts_.find(instance->id()); | 514 swapped_out_hosts_.find(instance->GetId()); |
512 if (iter != swapped_out_hosts_.end()) { | 515 if (iter != swapped_out_hosts_.end()) { |
513 // Re-use the existing RenderViewHost, which has already been initialized. | 516 // Re-use the existing RenderViewHost, which has already been initialized. |
514 // We'll remove it from the list of swapped out hosts if it commits. | 517 // We'll remove it from the list of swapped out hosts if it commits. |
515 pending_render_view_host_ = iter->second; | 518 pending_render_view_host_ = iter->second; |
516 | 519 |
517 // Prevent the process from exiting while we're trying to use it. | 520 // Prevent the process from exiting while we're trying to use it. |
518 pending_render_view_host_->process()->AddPendingView(); | 521 pending_render_view_host_->process()->AddPendingView(); |
519 | 522 |
520 return true; | 523 return true; |
521 } | 524 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 | 609 |
607 std::pair<RenderViewHost*, RenderViewHost*> details = | 610 std::pair<RenderViewHost*, RenderViewHost*> details = |
608 std::make_pair(old_render_view_host, render_view_host_); | 611 std::make_pair(old_render_view_host, render_view_host_); |
609 content::NotificationService::current()->Notify( | 612 content::NotificationService::current()->Notify( |
610 content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, | 613 content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, |
611 content::Source<NavigationController>( | 614 content::Source<NavigationController>( |
612 &delegate_->GetControllerForRenderManager()), | 615 &delegate_->GetControllerForRenderManager()), |
613 content::Details<std::pair<RenderViewHost*, RenderViewHost*> >(&details)); | 616 content::Details<std::pair<RenderViewHost*, RenderViewHost*> >(&details)); |
614 | 617 |
615 // If the pending view was on the swapped out list, we can remove it. | 618 // If the pending view was on the swapped out list, we can remove it. |
616 swapped_out_hosts_.erase(render_view_host_->site_instance()->id()); | 619 swapped_out_hosts_.erase(render_view_host_->site_instance()->GetId()); |
617 | 620 |
618 // If the old RVH is live, we are swapping it out and should keep track of it | 621 // If the old RVH is live, we are swapping it out and should keep track of it |
619 // in case we navigate back to it. | 622 // in case we navigate back to it. |
620 if (old_render_view_host->IsRenderViewLive()) { | 623 if (old_render_view_host->IsRenderViewLive()) { |
621 DCHECK(old_render_view_host->is_swapped_out()); | 624 DCHECK(old_render_view_host->is_swapped_out()); |
622 // Temp fix for http://crbug.com/90867 until we do a better cleanup to make | 625 // Temp fix for http://crbug.com/90867 until we do a better cleanup to make |
623 // sure we don't get different rvh instances for the same site instance | 626 // sure we don't get different rvh instances for the same site instance |
624 // in the same rvhmgr. | 627 // in the same rvhmgr. |
625 // TODO(creis): Clean this up. | 628 // TODO(creis): Clean this up. |
626 int32 old_site_instance_id = old_render_view_host->site_instance()->id(); | 629 int32 old_site_instance_id = old_render_view_host->site_instance()->GetId(); |
627 RenderViewHostMap::iterator iter = | 630 RenderViewHostMap::iterator iter = |
628 swapped_out_hosts_.find(old_site_instance_id); | 631 swapped_out_hosts_.find(old_site_instance_id); |
629 if (iter != swapped_out_hosts_.end() && | 632 if (iter != swapped_out_hosts_.end() && |
630 iter->second != old_render_view_host) { | 633 iter->second != old_render_view_host) { |
631 // Shutdown the RVH that will be replaced in the map to avoid a leak. | 634 // Shutdown the RVH that will be replaced in the map to avoid a leak. |
632 iter->second->Shutdown(); | 635 iter->second->Shutdown(); |
633 } | 636 } |
634 swapped_out_hosts_[old_site_instance_id] = old_render_view_host; | 637 swapped_out_hosts_[old_site_instance_id] = old_render_view_host; |
635 } else { | 638 } else { |
636 old_render_view_host->Shutdown(); | 639 old_render_view_host->Shutdown(); |
(...skipping 17 matching lines...) Expand all Loading... |
654 // This will possibly create (set to NULL) a Web UI object for the pending | 657 // This will possibly create (set to NULL) a Web UI object for the pending |
655 // page. We'll use this later to give the page special access. This must | 658 // page. We'll use this later to give the page special access. This must |
656 // happen before the new renderer is created below so it will get bindings. | 659 // happen before the new renderer is created below so it will get bindings. |
657 // It must also happen after the above conditional call to CancelPending(), | 660 // It must also happen after the above conditional call to CancelPending(), |
658 // otherwise CancelPending may clear the pending_web_ui_ and the page will | 661 // otherwise CancelPending may clear the pending_web_ui_ and the page will |
659 // not have it's bindings set appropriately. | 662 // not have it's bindings set appropriately. |
660 pending_web_ui_.reset(delegate_->CreateWebUIForRenderManager(entry.GetURL())); | 663 pending_web_ui_.reset(delegate_->CreateWebUIForRenderManager(entry.GetURL())); |
661 | 664 |
662 // render_view_host_ will not be deleted before the end of this method, so we | 665 // render_view_host_ will not be deleted before the end of this method, so we |
663 // don't have to worry about this SiteInstance's ref count dropping to zero. | 666 // don't have to worry about this SiteInstance's ref count dropping to zero. |
664 SiteInstance* curr_instance = render_view_host_->site_instance(); | 667 content::SiteInstance* curr_instance = render_view_host_->site_instance(); |
665 | 668 |
666 // Determine if we need a new SiteInstance for this entry. | 669 // Determine if we need a new SiteInstance for this entry. |
667 // Again, new_instance won't be deleted before the end of this method, so it | 670 // Again, new_instance won't be deleted before the end of this method, so it |
668 // is safe to use a normal pointer here. | 671 // is safe to use a normal pointer here. |
669 SiteInstance* new_instance = curr_instance; | 672 content::SiteInstance* new_instance = curr_instance; |
670 bool force_swap = ShouldSwapProcessesForNavigation( | 673 bool force_swap = ShouldSwapProcessesForNavigation( |
671 delegate_->GetLastCommittedNavigationEntryForRenderManager(), &entry); | 674 delegate_->GetLastCommittedNavigationEntryForRenderManager(), &entry); |
672 if (ShouldTransitionCrossSite() || force_swap) | 675 if (ShouldTransitionCrossSite() || force_swap) |
673 new_instance = GetSiteInstanceForEntry(entry, curr_instance); | 676 new_instance = GetSiteInstanceForEntry(entry, curr_instance); |
674 | 677 |
675 if (new_instance != curr_instance || force_swap) { | 678 if (new_instance != curr_instance || force_swap) { |
676 // New SiteInstance. | 679 // New SiteInstance. |
677 DCHECK(!cross_navigation_pending_); | 680 DCHECK(!cross_navigation_pending_); |
678 | 681 |
679 // Create a pending RVH and navigate it. | 682 // Create a pending RVH and navigate it. |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 swapped_out_hosts_.erase(iter); | 811 swapped_out_hosts_.erase(iter); |
809 break; | 812 break; |
810 } | 813 } |
811 } | 814 } |
812 } | 815 } |
813 | 816 |
814 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { | 817 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { |
815 if (!rvh->site_instance()) | 818 if (!rvh->site_instance()) |
816 return false; | 819 return false; |
817 | 820 |
818 return swapped_out_hosts_.find(rvh->site_instance()->id()) != | 821 return swapped_out_hosts_.find(rvh->site_instance()->GetId()) != |
819 swapped_out_hosts_.end(); | 822 swapped_out_hosts_.end(); |
820 } | 823 } |
OLD | NEW |