| 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/web_contents/render_view_host_manager.h" | 5 #include "content/browser/web_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" |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 | 639 |
| 640 // If the new RVH is swapped out already, store it. Otherwise prevent the | 640 // If the new RVH is swapped out already, store it. Otherwise prevent the |
| 641 // process from exiting while we're trying to navigate in it. | 641 // process from exiting while we're trying to navigate in it. |
| 642 if (swapped_out) { | 642 if (swapped_out) { |
| 643 swapped_out_hosts_[instance->GetId()] = new_render_view_host; | 643 swapped_out_hosts_[instance->GetId()] = new_render_view_host; |
| 644 } else { | 644 } else { |
| 645 new_render_view_host->GetProcess()->AddPendingView(); | 645 new_render_view_host->GetProcess()->AddPendingView(); |
| 646 } | 646 } |
| 647 | 647 |
| 648 bool success = InitRenderView(new_render_view_host, opener_route_id); | 648 bool success = InitRenderView(new_render_view_host, opener_route_id); |
| 649 if (success) { | 649 if (!swapped_out) { |
| 650 // Don't show the view until we get a DidNavigate from it. | 650 if (success) { |
| 651 new_render_view_host->GetView()->Hide(); | 651 // Don't show the view until we get a DidNavigate from it. |
| 652 new_render_view_host->GetView()->Hide(); |
| 652 | 653 |
| 653 // TODO(nasko): Send a frame tree update when creating the RV | 654 // TODO(nasko): Send a frame tree update when creating the RV |
| 654 // once http://crbug.com/153701 is fixed. | 655 // once http://crbug.com/153701 is fixed. |
| 655 } else if (!swapped_out) { | 656 } else { |
| 656 CancelPending(); | 657 CancelPending(); |
| 658 } |
| 657 } | 659 } |
| 658 } | 660 } |
| 659 | 661 |
| 660 // Use this as our new pending RVH if it isn't swapped out. | 662 // Use this as our new pending RVH if it isn't swapped out. |
| 661 if (!swapped_out) | 663 if (!swapped_out) |
| 662 pending_render_view_host_ = new_render_view_host; | 664 pending_render_view_host_ = new_render_view_host; |
| 663 | 665 |
| 664 return new_render_view_host->GetRoutingID(); | 666 return new_render_view_host->GetRoutingID(); |
| 665 } | 667 } |
| 666 | 668 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( | 971 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( |
| 970 SiteInstance* instance) { | 972 SiteInstance* instance) { |
| 971 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); | 973 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); |
| 972 if (iter != swapped_out_hosts_.end()) | 974 if (iter != swapped_out_hosts_.end()) |
| 973 return iter->second; | 975 return iter->second; |
| 974 | 976 |
| 975 return NULL; | 977 return NULL; |
| 976 } | 978 } |
| 977 | 979 |
| 978 } // namespace content | 980 } // namespace content |
| OLD | NEW |